Date for ToggleHeadings macro
Hello Again
I have 12 Sheets named -
,1
,2
,3
,4
,5
,6
,7
,8
,9
,10
,11
,12
Regards
Antonyo
"Dave Peterson" escribió en el mensaje
...
You have 12 sheets named: Jan, Feb, Mar, ..., Dec?
If yes, then how about something like:
Option Explicit
Sub auto_open()
Dim wks As Worksheet
Dim CurMonth As String
CurMonth = Format(Date, "mmm")
For Each wks In ThisWorkbook.Worksheets
With wks
.Select
ActiveWindow.DisplayHeadings _
= CBool((LCase(.Name) = LCase(CurMonth)))
End With
Next wks
End Sub
Although I do agree with Tim. The first thing I would do is show those
headers.
Antonyo wrote:
I Have 12 sheets, one for every month of the year
Jan is Sheet 1,Feb Is Sheet 2 and so on
I need the Headings to show on march (Sheet 3 ) if is march
if is April (Sheet 4) I need march off and April on
Is this Possible
Antonyo
"Dave Peterson" escribió en el mensaje
...
If you name the macro auto_open, it'll run when you open the workbook.
Then you can check the date to see if it should continue:
Sub auto_open()
if format(date,"mmyyyy") = "042005" then
ActiveWindow.DisplayHeadings = Not _
ActiveWindow.DisplayHeadings
else
'do nothing
end if
End Sub
Antonyo wrote:
Is there a way to start this macro by it self for the whole mont of
april
2005?
Thanks in advance
Sub ToggleHeadings()
ActiveWindow.DisplayHeadings = Not _
ActiveWindow.DisplayHeadings
End Sub
--
Dave Peterson
--
Dave Peterson
|