View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Password Protecting a command button

Note that security in Excel/VBA is very weak, so that anyone determined to
circumvent your password protection will be able to do it. That said, try
something like

Dim PW As String
PW = InputBox("Enter Password")
If StrComp(PW,"CorrectPassword",vbBinaryCompare) < 0 Then
MsgBox "Bad Password"
Exit Sub
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting LLC
www.cpearson.com
(email on the web site)


"newguyA14" wrote in message
...
I need to know how to set a command button, which clears many pages of
information to be there, but only accessable to the right people. E. I.
those with the password. I don't want anyone to clear by accident. Is
there
a way to protect only that button and leave the rest of the sheet
accessable
to everyone else in the shared workbook? Can this be done with a setting
or
with a string of programming. Please help.

A