Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
e e is offline
external usenet poster
 
Posts: 18
Default Macro + protection

I have just put my first macro in a sheet as a button which filters certain
row. I want to protect the majority of the sheet so that when I send it out
users can can only amend some cells, but be able to use the filter. When I
protect and click my macro button, it tells me I cannot do this with sheet
protection on.
I really want to use the protection as my users are liable to break pretty
spreadsheets, so can you think of a way I can both protect and use my filter
macro?
Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Macro + protection

Hi E

If you protect your sheet with your filter on you have a few options that you can check and one of them is Filtering
if your Excel version is not to old.

See
http://www.contextures.com/xlautofilter03.html#Protect




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"E" wrote in message ...
I have just put my first macro in a sheet as a button which filters certain
row. I want to protect the majority of the sheet so that when I send it out
users can can only amend some cells, but be able to use the filter. When I
protect and click my macro button, it tells me I cannot do this with sheet
protection on.
I really want to use the protection as my users are liable to break pretty
spreadsheets, so can you think of a way I can both protect and use my filter
macro?
Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Macro + protection

Hi,

Unprotect using code, run your filter and reprotect. Be aware though your
sheet even though protected isn't secure. Excel security is really to prevent
accidental dletions/changes.

Private Sub CommandButton1_Click()
ActiveSheet.Unprotect Password:="Mypass"
' do things
ActiveSheet.Protect Password:="Mypass"

End Sub


Mike
"E" wrote:

I have just put my first macro in a sheet as a button which filters certain
row. I want to protect the majority of the sheet so that when I send it out
users can can only amend some cells, but be able to use the filter. When I
protect and click my macro button, it tells me I cannot do this with sheet
protection on.
I really want to use the protection as my users are liable to break pretty
spreadsheets, so can you think of a way I can both protect and use my filter
macro?
Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
e e is offline
external usenet poster
 
Posts: 18
Default Macro + protection

PS I'm using Office 2007.

"E" wrote:

I have just put my first macro in a sheet as a button which filters certain
row. I want to protect the majority of the sheet so that when I send it out
users can can only amend some cells, but be able to use the filter. When I
protect and click my macro button, it tells me I cannot do this with sheet
protection on.
I really want to use the protection as my users are liable to break pretty
spreadsheets, so can you think of a way I can both protect and use my filter
macro?
Thanks.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Macro + protection

Hi E,

It is quite simple.
In your macro:
as first line of code use: ActiveSheet.Unprotect("MyPassword")
as last line of code use: ActiveSheet.Protect

If the Project window is not visible hit [Ctrl]+[R]
Next rightclick in the project window on the project you are editing
Select VBAProject properties
Goto tab "Protection"
Check "Lock project for viewing"
Enter and Confirm a password, ideally an other password as used for
protecting the sheet.

HTH,

Wouter



  #6   Report Post  
Posted to microsoft.public.excel.programming
e e is offline
external usenet poster
 
Posts: 18
Default Macro + protection

I need users to be able to filter and unfilter when they want. I unprotected,
filtered then re-protected, but then could not unfilter.

"Mike H" wrote:

Hi,

Unprotect using code, run your filter and reprotect. Be aware though your
sheet even though protected isn't secure. Excel security is really to prevent
accidental dletions/changes.

Private Sub CommandButton1_Click()
ActiveSheet.Unprotect Password:="Mypass"
' do things
ActiveSheet.Protect Password:="Mypass"

End Sub


Mike
"E" wrote:

I have just put my first macro in a sheet as a button which filters certain
row. I want to protect the majority of the sheet so that when I send it out
users can can only amend some cells, but be able to use the filter. When I
protect and click my macro button, it tells me I cannot do this with sheet
protection on.
I really want to use the protection as my users are liable to break pretty
spreadsheets, so can you think of a way I can both protect and use my filter
macro?
Thanks.

  #7   Report Post  
Posted to microsoft.public.excel.programming
e e is offline
external usenet poster
 
Posts: 18
Default Macro + protection

I have never used code before. I typed what you said and it appeared to work
because I could filter with protection on. But when I clicked 'unprotect' it
unprotected without asking me for a password!

"RadarEye" wrote:

Hi E,

It is quite simple.
In your macro:
as first line of code use: ActiveSheet.Unprotect("MyPassword")
as last line of code use: ActiveSheet.Protect

If the Project window is not visible hit [Ctrl]+[R]
Next rightclick in the project window on the project you are editing
Select VBAProject properties
Goto tab "Protection"
Check "Lock project for viewing"
Enter and Confirm a password, ideally an other password as used for
protecting the sheet.

HTH,

Wouter


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Macro + protection

No need for code, see my reply

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"E" wrote in message ...
I have never used code before. I typed what you said and it appeared to work
because I could filter with protection on. But when I clicked 'unprotect' it
unprotected without asking me for a password!

"RadarEye" wrote:

Hi E,

It is quite simple.
In your macro:
as first line of code use: ActiveSheet.Unprotect("MyPassword")
as last line of code use: ActiveSheet.Protect

If the Project window is not visible hit [Ctrl]+[R]
Next rightclick in the project window on the project you are editing
Select VBAProject properties
Goto tab "Protection"
Check "Lock project for viewing"
Enter and Confirm a password, ideally an other password as used for
protecting the sheet.

HTH,

Wouter


  #9   Report Post  
Posted to microsoft.public.excel.programming
e e is offline
external usenet poster
 
Posts: 18
Default Macro + protection

Unfortunately your reply does not allow for my corresponding unfliter macro.

"Ron de Bruin" wrote:

No need for code, see my reply

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"E" wrote in message ...
I have never used code before. I typed what you said and it appeared to work
because I could filter with protection on. But when I clicked 'unprotect' it
unprotected without asking me for a password!

"RadarEye" wrote:

Hi E,

It is quite simple.
In your macro:
as first line of code use: ActiveSheet.Unprotect("MyPassword")
as last line of code use: ActiveSheet.Protect

If the Project window is not visible hit [Ctrl]+[R]
Next rightclick in the project window on the project you are editing
Select VBAProject properties
Goto tab "Protection"
Check "Lock project for viewing"
Enter and Confirm a password, ideally an other password as used for
protecting the sheet.

HTH,

Wouter



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Data Protection- AKA: Sheet/Macro Password Protection Mushman(Woof!) Setting up and Configuration of Excel 0 December 29th 09 06:50 AM
macro Protection Warm Excel Worksheet Functions 1 May 28th 09 03:43 PM
Protection Macro Lois Excel Worksheet Functions 2 May 11th 09 04:45 PM
macro for protection ynissel Excel Discussion (Misc queries) 3 August 3rd 05 09:52 PM
Macro Protection N E Body[_16_] Excel Programming 1 November 16th 04 02:02 PM


All times are GMT +1. The time now is 11:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"