Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Set Sheets as variable
I am trying to set two sheets as variables and it is not working how I
thought it should. I have declared them like this Dim Sht As Worksheet Dim Env As Worksheets And tried to set them like this. Set Sht = Sheet1 Set Env = Sheet2 It errors out on the Set Env line. I am not sure how to make this right. I would prefer sot to have to use Sheet2 for evey place in my code that I have Env. Thanks, Jay |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Set Sheets as variable
On Dec 3, 10:57*am, jlclyde wrote:
I am trying to set two sheets as variables and it is not working how I thought it should. I have declared them like this * * Dim Sht As Worksheet * * Dim Env As Worksheets And tried to set them like this. * * Set Sht = Sheet1 * * Set Env = Sheet2 It errors out on the Set Env line. *I am not sure how to make this right. *I would prefer sot to have to use Sheet2 for evey place in my code that I have Env. Thanks, Jay My bad. I have one as sheet and the other as sheets. Sorry, Jay |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Set Sheets as variable
Instead of using variables that represent those sheets, you could just change
the codename to what you want. Open your workbook Go into the VBE Select your project select the worksheet object Hit F4 to see the project explorer Change the (Name) property (with the ()'s) to what you want. Then drop the dim statements completely. jlclyde wrote: On Dec 3, 10:57 am, jlclyde wrote: I am trying to set two sheets as variables and it is not working how I thought it should. I have declared them like this Dim Sht As Worksheet Dim Env As Worksheets And tried to set them like this. Set Sht = Sheet1 Set Env = Sheet2 It errors out on the Set Env line. I am not sure how to make this right. I would prefer sot to have to use Sheet2 for evey place in my code that I have Env. Thanks, Jay My bad. I have one as sheet and the other as sheets. Sorry, Jay -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
SUM command using variable sheets | Excel Worksheet Functions | |||
add new sheets in a workbook with new sheets being a variable | Excel Discussion (Misc queries) | |||
How to have a variable cell reference across sheets? | Excel Discussion (Misc queries) | |||
Need Help: 'sheets' function with a variable in a formula | Excel Worksheet Functions | |||
Use of variable to identify range of sheets in a workbook | Excel Discussion (Misc queries) |