nparsons75
Well-known Member
- Joined
- Sep 23, 2013
- Messages
- 1,256
- Office Version
- 2016
Hi, I have a worksheet which I protect with these settings.
Once set, all works well, however....
I have a macro I use which expands or retracts the row heights in my table. When I run this I use this code.
I have to activate and deactivate the password for the macro to work.
Heres the problem....
When I do this, the protect sheet selections are all erased...
These no longer apply...
Is there a way of retaining these settings either within or outside of the macr?
Thanks.
- Select unlocked cells
- Use auto filter
- Use pivot table and pivot chart
Once set, all works well, however....
I have a macro I use which expands or retracts the row heights in my table. When I run this I use this code.
Code:
Sub EXPAND()'
' EXPAND Macro
'
'
[COLOR=#ff0000]ActiveSheet.Unprotect Password:="password"[/COLOR]
Rows("19:19").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Rows.AutoFit
ActiveWindow.SmallScroll Down:=-15
Range("A1").Select
[COLOR=#ff0000] ActiveSheet.Protect Password:="password"[/COLOR]
End Sub
Sub RETRACT()
'
' RETRACT Macro
'
'
[COLOR=#ff0000]ActiveSheet.Unprotect Password:="password"[/COLOR]
Rows("19:19").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.RowHeight = 16
Range("J15").Select
ActiveWindow.SmallScroll Down:=-16
Range("A1").Select
[COLOR=#ff0000] ActiveSheet.Protect Password:="password"[/COLOR]
End Sub
I have to activate and deactivate the password for the macro to work.
Heres the problem....
When I do this, the protect sheet selections are all erased...
These no longer apply...
- Select unlocked cells
- Use auto filter
- Use pivot table and pivot chart
Is there a way of retaining these settings either within or outside of the macr?
Thanks.