Computing.Net > Forums > Office Software > excel macro to change sheets

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

excel macro to change sheets

Reply to Message Icon

Original Message
Name: mads69
Date: April 26, 2004 at 01:08:15 Pacific
Subject: excel macro to change sheets
OS: win 2k
CPU/Ram: n/a
Comment:

hi,
i was wondering if anyone know whether a macro can be created to check the date and then automatically change to the next sheet when it is the 1st of the month. i have a workbook with 12 sheets (one for each month) and would like it to change to the next sheet at the start of each month. i understand that macro's are created in a VB language but i am not familiar with VB so any help would be greatly appreciated.
thanking you in advance,

mads


Report Offensive Message For Removal


Response Number 1
Name: safeTsurfa
Date: April 26, 2004 at 11:14:15 Pacific
Reply: (edit)

Yes it can, you create it like a formula using IF THEN ELSE statements, checking for the current MONTH, not the day.

Read up your Excel Help documentation on this, the usage is there along with an example which you can paste into your macro area then adapt.

I'll give you a tip - don't tell it to go to a sheet by name, tell it to go there by worksheet number. Each worksheet has a reference number Excel uses to identify its location, basically numbering 1, 2, 3 etc from left to right along the tabline.

So example refer to the sheet as worksheets(1) instead of worksheets("sheet 1"). Using the number instead of the name means even if you change the sheet names after the macro is crated, the macro will still find the right one by its location along the tabline.

As for what you said about VB script, Excel doesn't use VB script. It uses a flavour of it called Visual Basic for Applications, and seriously no programming skills are needed until you get into the really intense stuff.

Again, whenever you need a macro you can't figure out, always search the Help files in Excel first (highlight the expression then press F1 for help on it), as the documentation is actually really good.


Report Offensive Follow Up For Removal

Response Number 2
Name: mads69
Date: April 27, 2004 at 00:31:59 Pacific
Reply: (edit)

cheers for that, has really helped.


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History




Data Recovery Software