View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
KimberlyC KimberlyC is offline
external usenet poster
 
Posts: 124
Default Code that ask user for a password before it runs..

Thank you all for your help!!
I will try the userform method as well..
I like the ****
:)
"KimberlyC" wrote in message
...
Hi,

I'm using this code below to delete some unused worksheets in the active
workbook.
I only want certain users to be able to use this feature..
so..
Is there a way to add code to this code below...that would ask the user

for
a password....maybe in a userform ...and then if they type in the correct
password, the code below runs..and if they type in an incorrect
password..this code does not run.


Sub DeleteBlankSheets()
Dim sht As Worksheet

For Each sht In ActiveWorkbook.Worksheets
If sht.Range("A3") = "Delete" Then
Application.DisplayAlerts = False
sht.Delete
Application.DisplayAlerts = True
End If

Next

End Sub

Any help is greatly appreciated!!
Thanks in advance,
Kimberly