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

And you can do something similar with a user form with a text box.

Except you can make the fore (font) color and back color both white, or
black, or ....
so that no one can see what is being typed.

Used to know how to make the font appear as *****, but can't find my
reference
maybe some one else can remember how to do that...

--
steveB

Remove "AYN" from email to respond
"N10" wrote in message
...
Sub DeleteBlankSheets()
Dim sht As Worksheet
dim ans as string
dim password as string

password = "pumpkin123"

ins = inputbox ( "PLEASE ENTER PASSWORD")
if ans is < " pumpkin123" then end


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




"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