Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here's the scenario:
In my workbook, I have a series of 12 chartsheets which have the names "Jan Duration" through "Dec Duration". These sheets graph monthly information. In the VBE, these sheets are named "cshtMonth01Dur" through "cshtMonth12Dur", so that I can loop from 1 to 12 and update the chart title on each of the sheets. Here's a portion of my code: For bytSheetLoopCounter = 1 To 12 If bytSheetLoopCounter < 10 Then strMonthNumber = "0" & bytSheetLoopCounter Else strMonthNumber = bytSheetLoopCounter End If strChartSheetName = "cshtMonth" & strMonthNumber & "Dur" Sheets(strChartSheetName).Select Next bytSheetLoopCounter When it gets to the 'Select' line, it triggers "run-time error '9': Subscript out of range" I know that the 'Sheets(strChartSheetName).Select' should read something like 'Sheets("Jan Duration").Select', but I can't see how to retrieve the name of a sheet when it's referenced by a variable. Any and all help would be greatly appreciated. Tom |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
reference to other sheet as a string | Excel Worksheet Functions | |||
SUM 3D Reference using variable sheet limits | Excel Worksheet Functions | |||
How To make a sheet reference Variable (eq: sum(sheet!D2:H2)) | Excel Discussion (Misc queries) | |||
Cell reference based on variable text string | Excel Worksheet Functions | |||
Cell reference - for the sheet name, can I use a variable? | Excel Discussion (Misc queries) |