Date for ToggleHeadings macro

  • Thread starter Thread starter Antonyo
  • Start date Start date
A

Antonyo

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
 
So you want the Headings to continually toggle on and off for a whole
month?
Won't that be a bit irritating?

I'm sure that's not what you mean, but perhaps you'd like to restate
your question....
Tim.
 
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
 
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
 
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.
 
Hello Again

I have 12 Sheets named -
,1
,2
,3
,4
,5
,6
,7
,8
,9
,10
,11
,12
Regards
Antonyo
 
They're named ",1", ",2", ..., ",12"????

That looks highly unusual to me.

Are they named "sheet 1" (with a space), "sheet1" (no space) or just "1" (no
sheet)?


Hello Again

I have 12 Sheets named -
,1
,2
,3
,4
,5
,6
,7
,8
,9
,10
,11
,12
Regards
Antonyo
 
Hello Dave

On the VBAProject shows

VBAProject(Furniture.xls)
-Microsoft Excel Objects

Sheet(1),1
Sheet(2),2
Sheet(3),3
Sheet(4),4
Sheet(5),5
Sheet(6),6
Sheet(7),7
Sheet(8),8
Sheet(9),9
Sheet(10),10
Sheet(11),11
Sheet(12),12
ThisWorkbook

I made this workbook on HTML if you like to take a look of it
If not is Ok I understand

http://www.geocities.com/antonioata/Excel/Furniture.htm

Regards
Antonyo
 
I bet that the codenames (first in that list) didn't really have the ()'s in
them.

More like:
Sheet1 (1)
Sheet2 (2)
Sheet3 (3)
....
Sheet12 (12)

Maybe this one:

Option Explicit
Sub auto_open()

Dim wks As Worksheet
Dim CurMonth As String

CurMonth = Format(Date, "m")

For Each wks In ThisWorkbook.Worksheets
With wks
.Select
ActiveWindow.DisplayHeadings _
= CBool((LCase(.Name) = LCase(CurMonth)))
End With
Next wks

End Sub




Hello Dave

On the VBAProject shows

VBAProject(Furniture.xls)
-Microsoft Excel Objects

Sheet(1),1
Sheet(2),2
Sheet(3),3
Sheet(4),4
Sheet(5),5
Sheet(6),6
Sheet(7),7
Sheet(8),8
Sheet(9),9
Sheet(10),10
Sheet(11),11
Sheet(12),12
ThisWorkbook

I made this workbook on HTML if you like to take a look of it
If not is Ok I understand

http://www.geocities.com/antonioata/Excel/Furniture.htm

Regards
Antonyo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top