Dynamic Variable Names

vonryan

New member
Joined
Feb 4, 2021
Messages
10
Reaction score
0
Points
0
Excel Version(s)
365
Dear All,

I have some VBA where I am declaring SEATTab as an object

Code:
Dim SEATTab As Object
Set SEATTab = CreateObject("Scripting.Dictionary")
Dim SEATTabName As String
I set the variables as follows:

Code:
SEATTab1 = "F01_F003"
SEATTab2 = "F01_F004"
SEATTab3 = "F02_F003"
SEATTab4 = "F02_F004"
SEATTab5 = "F02_F008"
SEATTab6 = "F02_P007"
SEATTab7 = "F03_F003"
SEATTab8 = "F04_F003"
SEATTab9 = "F04_F004"
SEATTab10 = "F05_F003"
SEATTab11 = "F05_F004"
SEATTab12 = "F05_F008"
SEATTab13 = "F05_P007"
SEATTab14 = "F00"

I then loop through the tabs to do some work.

Code:
For TabCount = TabCountStart To TabCountEnd
        'Load Tab Name
        SEATTabName = SEATTab(TabCount)
        'Activate Source Worksheet
        Worksheets(SEATTabName).Activate
This works in another module but it does not work in this module and I do not know why.

The issue is the the SEATTab(TabCount) value is not copied to the variable SEATTabName




Your assistance would be gratefully appreciated. I can send the full module if required.

Von Ryan
 
Last edited by a moderator:
Back
Top