+ Reply to Thread
Results 1 to 4 of 4

Reference Worksheets Using Variables In A Table

  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

    Please Login or Register  to view this content.
    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.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,861

    Re: Reference Worksheets Using Variables In A Table

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not told us about this. You are required to do so. Cross-posts are allowed but you must provide a link to your posts on other sites.
    For new members: you will not be able to post a full URL, so remove the https://www. section and add one or two breaks to the rest of the address. A Moderator or Admin will then fix the link for you.

    Please see Forum Rule #7 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important: https://excelguru.ca/a-message-to-forum-cross-posters/

    (Note: this requirement is not optional. As you are new here, I shall do it for you this time: https://www.mrexcel.com/board/thread...table.1273631/)

    Additional crossposts:
    https://chandoo.org/forum/threads/re...a-table.58640/
    https://stackoverflow.com/questions/...les-in-a-table
    Last edited by alansidman; 06-29-2025 at 07:41 PM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,526

    Re: Reference Worksheets Using Variables In A Table

    I have no idea what you're trying to achieve but maybe something like this helps.
    According the value in Range U3 one book or another gets activated.
    There is no error checking thus when the workbook isn't open you'll receive an error message.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2505
    Posts
    27,207

    Re: Reference Worksheets Using Variables In A Table

    Welcome to the Forum Deakzy67!

    Your profile says
    Quote Originally Posted by Deakzy67 View Post
    MS-Off Ver: Business
    but that is not an Excel version. Please update your profile to show the commercial release name (e.g., Excel 2016, Excel 2024, Microsoft 365). It is also helpful to include the update version, which will look like 2502 to indicate year and month the update was released. Knowing your Excel version will allow us to tailor a solution that we know will work for you. Thanks,
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ Reply to Thread

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