Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default IF then GoTo

I have a summary sheet and one sheet for each month.
I have formatted a cell, sheet1("Z1") to display only the month value
and inserted =Today() in the formula bar for that cell.
I am trying to use "IF" in a macro to goto the appropriate month Sheet
based on the value of Sheet1 ("Z1").

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default IF then GoTo

Hi Richard

to move to a specific worksheet you can use:

worksheets("worksheetname").activate

you have 12 sheets maybe named

month1, month2, month3...
or
jan,feb,mar...

if it is the first case then try

activeworkbooks.worksheets("month" & month(Now)).activate

or if it is the second you can try:

activeworkbooks.worksheets("month" & format(month(Now),"mmm")).activate

or

select case (activeworkbooks.worksheets("total").range("Z1"))
case 1: activeworkbooks.worksheets("month1").activate
case 2: activeworkbooks.worksheets("month2").activate
case 3: activeworkbooks.worksheets("month3").activate
'...
case else: 'some error
end select

--
Hope this helps
Martin Fishlock


" wrote:

I have a summary sheet and one sheet for each month.
I have formatted a cell, sheet1("Z1") to display only the month value
and inserted =Today() in the formula bar for that cell.
I am trying to use "IF" in a macro to goto the appropriate month Sheet
based on the value of Sheet1 ("Z1").


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
? IF & GOTO ? Karen D Excel Worksheet Functions 17 September 2nd 09 10:58 PM
? IF and GOTO ? Karen D Excel Worksheet Functions 2 September 1st 09 07:57 PM
If.....Then GoTo....... Alec H Excel Discussion (Misc queries) 4 February 22nd 06 02:42 PM
On Error Goto doesn't goto Paul Excel Programming 1 October 15th 04 03:51 PM
On Error Goto doesn't goto Paul Excel Programming 0 October 15th 04 03:05 PM


All times are GMT +1. The time now is 11:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"