Using Macro to Select Worksheet
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
|