Results 1 to 1 of 1

Thread: Dynamic Variable Names

  1. #1
    Seeker vonryan's Avatar
    Join Date
    Feb 2021
    Posts
    10
    Articles
    0
    Excel Version
    365

    Dynamic Variable Names



    Register for a FREE account, and/
    or Log in to avoid these ads!

    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 p45cal; 2021-06-04 at 11:28 AM. Reason: added code tags

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •