View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Macro button that asks for password before proceeding?

Try the below...password is ........ mypassword

Sub Macro()

Dim strPassword As String
Do While Trim(strPassword) < "mypassword"
strPassword = Trim(InputBox("Enter Password"))
Loop

Sheets("POLICY LIST").Select
Rows("1:1").Select
Selection.EntireRow.Hidden = False
Rows("2:6").Select
Selection.EntireRow.Hidden = True
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Munchkin" wrote:

How & where do I specify what the password is? I tried entering the password
inside the quotation marks, but it didn't work.

"Jacob Skaria" wrote:


Sub Macro()

Dim strPassword As String
Do While Trim(strPassword) = ""
strPassword = Trim(InputBox("Enter Password"))
Loop

Sheets("POLICY LIST").Select
Rows("1:1").Select
Selection.EntireRow.Hidden = False
Rows("2:6").Select
Selection.EntireRow.Hidden = True
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Munchkin" wrote:

Is there a way to stop the user and have the prompted to enter a password
before this macro button is run? I was this to only be an option for
Administrative purposes only.

Sheets("POLICY LIST").Select
Rows("1:1").Select
Selection.EntireRow.Hidden = False
Rows("2:6").Select
Selection.EntireRow.Hidden = True
End Sub