View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_482_] Leith Ross[_482_] is offline
external usenet poster
 
Posts: 1
Default Worksheet Expiration


Hello Brian,

This macro should get you going. Just change the Worksheet name to
match the name of your "Very hiddden Worksheet" and cell "A1" to cell
that will hold your expiration date. Set the variable "UsableDays" to
the number of days that can pass before the worksheet expires.

'<Start Macro Code
Sub CheckExpiration()

Dim DaysElapsed
Dim ExpirationDate
Dim HiddenSheet As Worksheet
Dim UsableDays
Dim Wks

UsableDays = 30
Set HiddenSheet = Worksheets("Sheet3")
ExpirationDate = HiddenSheet.Range("A1").Value

DaysElapsed = Int(Now) - Int(ExpirationDate)

If DaysElapsed = UsableDays Then
For Each Wks In Worksheets
If Wks.Name < HiddenSheet.Name Then
Wks.Visible = False
End If
Next Wks
End If

End Sub
'<End Macro Code

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=503490