Password for running Macro

J

Jim

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?
 
M

Master Blaster

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top