babycody
Well-known Member
- Joined
- Jul 8, 2003
- Messages
- 1,395
I know this has been asked before. I did a search for making a sheet hidden after a date has passed unless a password is entered. I tried a few of these, but I am a novice coder. When I tried these out I never get a prompt to enter password, or a place to enter password. Here is one of the codes I liked:
It was written by Half Ace. I changed the date and entered my password in where the code has "password". I also entered the sheet name where it has ("YourSheetName") It did hide the sheet, but never prompted me for a password. I left the quotation marks. I assume that was the correct thing to do. Is there something I am missing? Do I have to create a form for the password to be entered into? How would I tie all of this together if I do? On the post this code came from they mentioned Dim "ans", but never came back to an explanation of what this did. Thanks for any help on this.
http://www.mrexcel.com/board2/viewt...storder=asc&highlight=password+expire&start=0
Code:
Option Explicit
Private Sub Worksheet_Activate()
If Date > #6/7/2004# Then
MsgBox "This worksheet has expired. (Pay up sucka!)"
ActiveSheet.Protect "password"
Sheets(1).Select
Sheets("YourSheetName").Visible = xlVeryHidden
End If
End Sub
It was written by Half Ace. I changed the date and entered my password in where the code has "password". I also entered the sheet name where it has ("YourSheetName") It did hide the sheet, but never prompted me for a password. I left the quotation marks. I assume that was the correct thing to do. Is there something I am missing? Do I have to create a form for the password to be entered into? How would I tie all of this together if I do? On the post this code came from they mentioned Dim "ans", but never came back to an explanation of what this did. Thanks for any help on this.
http://www.mrexcel.com/board2/viewt...storder=asc&highlight=password+expire&start=0