Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You declare SelectAIM as a Name, but then you never set it to anything
before trying to use it. Also, Name is an undefined variable in your code below that you set equal to a range. If you use Option Explicit at the beginning of your code, you will get error messages when you try to use variables you have not declared, or which you try to set to an object type that is different from what you declared. Having said that, I haven't tested this, but I believe something like the code below may work for you. Option Explicit Sub SelectAIM() Windows("Weekly Setup.xls").Activate Dim SelectAIM As Range Set SelectAIM = Worksheets("Sheet1").Range("E2") Windows(SelectAIM.Value).Activate End Sub Mark samothman wrote: I would like to select a worksheet based on a value in a specific cell, I have tryed everything I know and am unable to accomplish. Here is the code. Note: There are 8 different workbooks I am trying to move between and I have already opened all with a macro command. I am using the workbook Weeky Setup as my "home". The names of the workbooks change every week. Sub SelectAIM() Windows("Weekly Setup.xls").Activate Dim SelectAIM As Name Set Name = Worksheets("Sheet1").Range("E2") Windows(SelectAIM).Activate End Sub Worksheet "Weekly Setup.xls" is my "master" workbook. I want to select the workbook as defined in cell "E2" in Weekly Setup |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
select worksheet and run macro | Excel Programming | |||
Select Worksheet to print Macro | Excel Worksheet Functions | |||
why does this macro select the entire worksheet when run? | Excel Discussion (Misc queries) | |||
select worksheet to run macro | Excel Discussion (Misc queries) | |||
Help Please! Macro Error on Select Worksheet | Excel Programming |