All2Cheesy
Board Regular
- Joined
- Mar 4, 2015
- Messages
- 127
Hi all,
I've got various bits of code which refer directly to the password currently used to lock excel sheets. The code works fine, however, this causes a couple of issues.
Firstly, the code is not dynamic, and won't function correctly if the password has been changed
and secondly, if someone were to get a glimpse at the code, they would be able to see the password.
I used to have userinterface turned on which resolved this issue, but caused other issues down the line. Is there a way around the above issues?
As always, your help is appreciated.
I've got various bits of code which refer directly to the password currently used to lock excel sheets. The code works fine, however, this causes a couple of issues.
Firstly, the code is not dynamic, and won't function correctly if the password has been changed
and secondly, if someone were to get a glimpse at the code, they would be able to see the password.
I used to have userinterface turned on which resolved this issue, but caused other issues down the line. Is there a way around the above issues?
Code:
Sub ShowHideReturnRates()
'Unlock Sheet
[COLOR="#FF0000"]ActiveSheet.Unprotect Password:="password"[/COLOR]
'Show/Hide Return Rates
If Columns("L:T").Hidden = True Then
Columns("L:T").Hidden = False
Else
Columns("L:T").Hidden = True
End If
'Lock Sheet
[COLOR="#FF0000"]ActiveSheet.Protect Password:="password"[/COLOR]
End Sub
As always, your help is appreciated.