![]() |
Using an Input Box to Unprotect a Worksheet
I have what is probably an easy question but I cannot seem to come up with a
solution. I have a worksheet that I am protecting various columns with a password. On the worksheet I have a button with a macro attached to it. I would like to have an InputBox appear requesting a password that will unprotect the worksheet when the button is clicked. All help is greatly appreciated. Thanks. |
Using an Input Box to Unprotect a Worksheet
Pablo,
This utilises an inputbox so there is no password mask and it can be read by anyone looking. You can have a masked input box but that is more complicated or you can use a userform to look like an input box and have a password mask in that Sub Button1_Click() response = InputBox("Enter Password") On Error GoTo GetMeOut ActiveSheet.Unprotect Password:=response 'your code Exit Sub GetMeOut: MsgBox "Incorrect password supplied" End Sub Mike "Pablo" wrote: I have what is probably an easy question but I cannot seem to come up with a solution. I have a worksheet that I am protecting various columns with a password. On the worksheet I have a button with a macro attached to it. I would like to have an InputBox appear requesting a password that will unprotect the worksheet when the button is clicked. All help is greatly appreciated. Thanks. |
Using an Input Box to Unprotect a Worksheet
Thank you very much.
"Mike H" wrote: Pablo, This utilises an inputbox so there is no password mask and it can be read by anyone looking. You can have a masked input box but that is more complicated or you can use a userform to look like an input box and have a password mask in that Sub Button1_Click() response = InputBox("Enter Password") On Error GoTo GetMeOut ActiveSheet.Unprotect Password:=response 'your code Exit Sub GetMeOut: MsgBox "Incorrect password supplied" End Sub Mike "Pablo" wrote: I have what is probably an easy question but I cannot seem to come up with a solution. I have a worksheet that I am protecting various columns with a password. On the worksheet I have a button with a macro attached to it. I would like to have an InputBox appear requesting a password that will unprotect the worksheet when the button is clicked. All help is greatly appreciated. Thanks. |
All times are GMT +1. The time now is 09:57 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com