View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Paul B Paul B is offline
external usenet poster
 
Posts: 709
Default protecting a macro button

mydogpeanut, you could ask for a password to run the macro, something like
this

Sub PassWord_To_Run_Macro()
'must lock VBA project so you can't see the password in it

Dim MyStr1 As String, MyStr2 As String
With ActiveSheet
MyStr2 = ("123") 'This is the password and it is CASE sensitive
MyStr1 = InputBox("Password Is Required To Run this Macro ")
If MyStr1 = MyStr2 Then

'your code here

Else
MsgBox ("Access Denied")
End If
End With
End Sub
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003


"mydogpeanut" wrote in message
...
I have a spreadsheet set up with a few macro buttons and I was looking for
a
way to protect those buttons so that only certain users would be able to
push
them.

Is there any way to do this?

Thanks so much!!!