View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Paul B[_6_] Paul B[_6_] is offline
external usenet poster
 
Posts: 135
Default PASSWORD PROMPTING CODE

Jay, how about something like this

Sub PassWord_for_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") 'change to your password
MyStr1 = InputBox("Password Is Required To Run this Macro ")
If MyStr1 = MyStr2 Then
'*******your code here********
Else
MsgBox ("Password Does Not Match, Access Denied")
End If
End With
End Sub

--
Paul B
Always backup your data before trying something new
Using Excel 2000 & 97
Please post any response to the newsgroups so others can benefit from it
** remove news from my email address to reply by email **
"Jay Dean" wrote in message
om...
I have assigned a macro code to a command button in Excel. I need a
macro code to add to my original code that will prompt any user that
pushes the button to enter a password before the code assigned to the
button executes.
Any assistance will be appreciated.Thanks!

Jay Dean.