Thread: IF then GoTo
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Ken Johnson Ken Johnson is offline
external usenet poster
 
Posts: 1,073
Default IF then GoTo

Ken Johnson wrote:
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").


Hi Richard,

In VBA, with Today() in Sheet1!Z1...

MonthName(Month(Sheet1.Range("Z1")),False)

currently returns "November"

MonthName(Month(Sheet1.Range("Z1")),True)

currently returns "Nov"

Does this help?

Ken Johnson


Hi Richard,

Also, to use a macro to goto the appropriate worksheet, assuming the
full month name is used on each sheet tab, ie November not Nov...

Public Sub GotoMonthSheet()
Worksheets(MonthName(Month(Sheet1.Range("z1")), False)).Activate
End Sub

will take you there.

Ken Johnson