Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hey guys,
I have this macro and I want my worksheet to be protected but it says I am not able to protect the sheet because of the macro. Is there any way around it? Thanks -- Stu |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I forgot one thing, the code...
so here it is: Private Sub Worksheet_Activate() Call Main End Sub Sub Main() Dim hideRows As Range Application.ScreenUpdating = False With Range("G3:G2401") .EntireRow.Hidden = False .AutoFilter Field:=1, Criteria1:="=" On Error Resume Next Set hideRows = .Offset(1, 0).SpecialCells(xlCellTypeVisible) On Error GoTo 0 End With Selection.AutoFilter If Not hideRows Is Nothing Then hideRows.EntireRow.Hidden = True Range("G202,G402,G602,G802,G1002,G1202,G1402," & _ "G1602,G1802,G2002,G2202,G2402").EntireRow.Hid den = False Application.ScreenUpdating = True End Sub Thanks -- Stu |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"It" says ???
You have two options. One is protecting by code, userinterface only: Sheets(1).Protect Password:="Yo", _ UserInterfaceOnly:=True Now macros can do more things than the user is allowed. Or you can simply have your macro unprotect-work-protect like this Sheets(1).Unrotect Password:="Yo" 'autofilter, hide, stuff Sheets(1).Protect Password:="Yo" -- HTH. Best wishes Harald Followup to newsgroup only please. "Stu" wrote in message ... Hey guys, I have this macro and I want my worksheet to be protected but it says I am not able to protect the sheet because of the macro. Is there any way around it? Thanks -- Stu |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What if the user looks in the code? the password is viewable.
-- Stu "Harald Staff" wrote in message ... "It" says ??? You have two options. One is protecting by code, userinterface only: Sheets(1).Protect Password:="Yo", _ UserInterfaceOnly:=True Now macros can do more things than the user is allowed. Or you can simply have your macro unprotect-work-protect like this Sheets(1).Unrotect Password:="Yo" 'autofilter, hide, stuff Sheets(1).Protect Password:="Yo" -- HTH. Best wishes Harald Followup to newsgroup only please. "Stu" wrote in message ... Hey guys, I have this macro and I want my worksheet to be protected but it says I am not able to protect the sheet because of the macro. Is there any way around it? Thanks -- Stu |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can prevent that in the VB editor menu Tools VBA proj Properties Protection. But
I'd prefer hiding or masking the password instead; unlocked code may provide you with good debugging information until the code is perfect. Anyway, you're too paranoid. Excel is not safe and sheet passwords can be cracked easily. Security is basically there to prevent fools from doing severe damage to formulas, not to protect our digital rights. -- HTH. Best wishes Harald Followup to newsgroup only please. "Stu" wrote in message ... What if the user looks in the code? the password is viewable. -- Stu "Harald Staff" wrote in message ... "It" says ??? You have two options. One is protecting by code, userinterface only: Sheets(1).Protect Password:="Yo", _ UserInterfaceOnly:=True Now macros can do more things than the user is allowed. Or you can simply have your macro unprotect-work-protect like this Sheets(1).Unrotect Password:="Yo" 'autofilter, hide, stuff Sheets(1).Protect Password:="Yo" -- HTH. Best wishes Harald Followup to newsgroup only please. "Stu" wrote in message ... Hey guys, I have this macro and I want my worksheet to be protected but it says I am not able to protect the sheet because of the macro. Is there any way around it? Thanks -- Stu |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That is true I am too paranoid and for no reason, because like you say it is
to prevent fools from messing with things they shouldn't but I know a lot of fools who will probably venture into the code and mess that up too. And I cant seem to get the: Sheets(1).Protect Password:="Yo", _ UserInterfaceOnly:=True or Sheets(1).Unrotect Password:="Yo" 'autofilter, hide, stuff Sheets(1).Protect Password:="Yo" to work. Thanks -- Stu "Harald Staff" wrote in message ... You can prevent that in the VB editor menu Tools VBA proj Properties Protection. But I'd prefer hiding or masking the password instead; unlocked code may provide you with good debugging information until the code is perfect. Anyway, you're too paranoid. Excel is not safe and sheet passwords can be cracked easily. Security is basically there to prevent fools from doing severe damage to formulas, not to protect our digital rights. -- HTH. Best wishes Harald Followup to newsgroup only please. "Stu" wrote in message ... What if the user looks in the code? the password is viewable. -- Stu "Harald Staff" wrote in message ... "It" says ??? You have two options. One is protecting by code, userinterface only: Sheets(1).Protect Password:="Yo", _ UserInterfaceOnly:=True Now macros can do more things than the user is allowed. Or you can simply have your macro unprotect-work-protect like this Sheets(1).Unrotect Password:="Yo" 'autofilter, hide, stuff Sheets(1).Protect Password:="Yo" -- HTH. Best wishes Harald Followup to newsgroup only please. "Stu" wrote in message ... Hey guys, I have this macro and I want my worksheet to be protected but it says I am not able to protect the sheet because of the macro. Is there any way around it? Thanks -- Stu |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Why are you talking about users. You said *You* would be using xl2002, so
limitations of xl97 were of no consequence. Now you have users - will they all also be using xl2002? If not, you have more surprises headed your way. Using userinterfaceonly will not work with your autofilter code. Userinterfaceonly only works with an already existing filter. There is no reason the unprotect shouldn't work if you spell it correctly and the password is the correct password. The other method I showed will work with userinterfaceonly, of course. -- Regards, Tom Ogilvy Stu wrote in message ... That is true I am too paranoid and for no reason, because like you say it is to prevent fools from messing with things they shouldn't but I know a lot of fools who will probably venture into the code and mess that up too. And I cant seem to get the: Sheets(1).Protect Password:="Yo", _ UserInterfaceOnly:=True or Sheets(1).Unrotect Password:="Yo" 'autofilter, hide, stuff Sheets(1).Protect Password:="Yo" to work. Thanks -- Stu "Harald Staff" wrote in message ... You can prevent that in the VB editor menu Tools VBA proj Properties Protection. But I'd prefer hiding or masking the password instead; unlocked code may provide you with good debugging information until the code is perfect. Anyway, you're too paranoid. Excel is not safe and sheet passwords can be cracked easily. Security is basically there to prevent fools from doing severe damage to formulas, not to protect our digital rights. -- HTH. Best wishes Harald Followup to newsgroup only please. "Stu" wrote in message ... What if the user looks in the code? the password is viewable. -- Stu "Harald Staff" wrote in message ... "It" says ??? You have two options. One is protecting by code, userinterface only: Sheets(1).Protect Password:="Yo", _ UserInterfaceOnly:=True Now macros can do more things than the user is allowed. Or you can simply have your macro unprotect-work-protect like this Sheets(1).Unrotect Password:="Yo" 'autofilter, hide, stuff Sheets(1).Protect Password:="Yo" -- HTH. Best wishes Harald Followup to newsgroup only please. "Stu" wrote in message ... Hey guys, I have this macro and I want my worksheet to be protected but it says I am not able to protect the sheet because of the macro. Is there any way around it? Thanks -- Stu |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro with protect sheet | Excel Discussion (Misc queries) | |||
Protect macro from stopping | Excel Discussion (Misc queries) | |||
Protect macro | Excel Discussion (Misc queries) | |||
How to protect my macro | Excel Discussion (Misc queries) | |||
Macro to protect with pword in 97 | Excel Programming |