Results 1 to 4 of 4

Reference Worksheets Using Variables In A Table

Threaded View

  1. #1
    Registered User
    Join Date
    06-29-2025
    Location
    Australia
    MS-Off Ver
    Business
    Posts
    1

    Reference Worksheets Using Variables In A Table

    I am very green at this so be gentle with me.

    What I would like to do is use table data in a master document to move between documents in VBA. I have other grand plans but this is the first step. And I am stuck already

    The cell U3 in my master doc references text "D_1" and I want this to change the window / workbook to "Week 1.cvs".

    If I change the main line to Windows(D_2).Active this functions perfect.

    I will of course populate this significantly more once I get this to function.

    Any advice greatly appreciated.

    Cheers

    Sub Window_Display_Test()
    '
    ' Window_Display_Test Macro
    
    
    Dim D_1 As String: D_1 = ("Week 1.CSV")
    
    For i = 3 To 11
    
    Dim Cur_Window As Range: Set Cur_Window = Range("u" & i)
    
    MsgBox (Cur_Window)
    
    Windows(Cur_Window).Activate
    
    Next i
    
    End Sub
    Expected this to change between open windows / workbooks.

    Instead came up with a RUNTIME error
    Last edited by AliGW; 06-29-2025 at 03:14 AM. Reason: Code tags added - please review the forum guidelines.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Table color count w/variables and reference range
    By confusionjunction in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 03-04-2025, 07:41 PM
  2. Using variables to get a cell reference
    By billyshears in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-07-2020, 05:25 PM
  3. Replies: 4
    Last Post: 06-07-2019, 07:44 AM
  4. Replies: 5
    Last Post: 03-01-2018, 11:40 AM
  5. How to set up reference variables?
    By cjhund in forum Excel - New Users/Basics
    Replies: 22
    Last Post: 04-18-2011, 11:03 AM
  6. Obtaining a reference from 2 variables.
    By cleggy621 in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 04-29-2008, 06:17 AM
  7. using variables to reference sheets
    By marksince1984 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-15-2006, 06:29 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1