Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to copy data from one worksheet into another based on the value
in one of the cells in the original worksheet. I have declared the variable and set the Sheets.select as follows Dim sheetName Sheets(sheetName).Select when the code gets to the Sheets(sheetName).Select line it gives a Runtime error and says Subscript out of range. Any ideas why this is happenig and how to correct it. Thanks Neal |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It means that there is not a worksheet with the name that is contained
within the variable SheetName. You have either mis-spelt, or not loaded it into that variable. -- __________________________________ HTH Bob "Neal Ostrander" wrote in message ... I am trying to copy data from one worksheet into another based on the value in one of the cells in the original worksheet. I have declared the variable and set the Sheets.select as follows Dim sheetName Sheets(sheetName).Select when the code gets to the Sheets(sheetName).Select line it gives a Runtime error and says Subscript out of range. Any ideas why this is happenig and how to correct it. Thanks Neal |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You have not assigned any value to the variable sheetName before using it...
Try Dim sheetName sheetName = "Name of your sheet here" Sheets(sheetName).Select "Neal Ostrander" wrote: I am trying to copy data from one worksheet into another based on the value in one of the cells in the original worksheet. I have declared the variable and set the Sheets.select as follows Dim sheetName Sheets(sheetName).Select when the code gets to the Sheets(sheetName).Select line it gives a Runtime error and says Subscript out of range. Any ideas why this is happenig and how to correct it. Thanks Neal |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using a variable to select a cell on a worksheet..."Subscript out orrange" | Excel Programming | |||
select cell by variable name | Excel Discussion (Misc queries) | |||
worksheet select using variable | Excel Programming | |||
In Excel 2000, How do you select the whole of a worksheet (Select. | Excel Discussion (Misc queries) | |||
In Excel 2000, How do you select the whole of a worksheet (Select. | Excel Discussion (Misc queries) |