Can a Macro on exel be set with a password?

G

Guest

I would like a macro button to be password protected on a spread sheet that I
have, so people can look a things on the other sheets, but not on one of them.
Thanks

Dave
 
S

Sasa Stankovic

if you need to protect worksheet try next:
activate sheet -> Format->Sheet->Hide
Tools->Protection->Protect Worksheet
 
G

Gord Dibben

Dave

What do you mean by "macro button to be password protected"?

If you don't want anyone to see the sheet, hide the sheet then protect the
workbook for windows and structure.

If you don't want anyone to run a macro from your button, password protect the
code.

Sub foo()
Dim mypword As String
mypword = InputBox("enter a password")
If mypword <> "drowssap" Then
MsgBox "wrong password"
Exit Sub
Else
MsgBox "what now, brown cow"
End If
End Sub


Gord Dibben MS Excel MVP
 

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

Similar Threads

how to round up in exel to nerest cent 0
vba solution for protection 3
Macros 1
Excel Excel macro and passwords 3
Expanding beyond "Very Hidden" 1
Protect Sheet Macro 1
Unhide, Unprotect, Enter Password 2
Collapsing all groups 0

Top