ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Password for running Macro (https://www.excelbanter.com/excel-programming/440410-password-running-macro.html)

Jim[_78_]

Password for running Macro
 
I need to hide and unhide some columns using a macro and then prompt for a
password when unhiding. I used the protect worksheet function and set a
password, and this worked fine. My user has now informed me that the protect
worksheet will already be in use.....

so now I just need to have a macro that hides some columns, but the unhide
is prompted by a password. Is this possible without using the protect
worksheet function?


Jim[_78_]

Password for running Macro
 
cracked it; please ignore!

"Jim" wrote in message
...
I need to hide and unhide some columns using a macro and then prompt for a
password when unhiding. I used the protect worksheet function and set a
password, and this worked fine. My user has now informed me that the
protect worksheet will already be in use.....

so now I just need to have a macro that hides some columns, but the unhide
is prompted by a password. Is this possible without using the protect
worksheet function?



Master Blaster

Password for running Macro
 
Jim,

Your question is not completely clear; but maybe the code below will
help you:

yourPW= InputBox("password")

ActiveSheet.Unprotect Password:=yourPW

Columns("D:D").Select
Selection.EntireColumn.Hidden = True

Columns("D:D").Select
Selection.EntireColumn.Hidden = True

hope this helps.






On Mar 9, 10:31*am, "Jim" wrote:
I need to hide and unhide some columns using a macro and then prompt for a
password when unhiding. I used the protect worksheet function and set a
password, and this worked fine. My user has now informed me that the protect
worksheet will already be in use.....

so now I just need to have a macro that hides some columns, but the unhide
is prompted by a password. Is this possible without using the protect
worksheet function?




All times are GMT +1. The time now is 03:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com