+ Reply to Thread
Results 1 to 3 of 3

Use variable column reference in VBA worksheet function

  1. #1
    Registered User
    Join Date
    06-25-2014
    Location
    Michigan, US
    MS-Off Ver
    2010
    Posts
    8

    Use variable column reference in VBA worksheet function

    I've been stuck on this for a while now, I hope someone can help. I have the following line in VBA which works.

    Please Login or Register  to view this content.
    I need to replace the range $V:$V because it changes depending on which worksheet is active. I have a variable that will change depending on the sheet. How can I work it into the formula using the correct syntax.

    Can anyone help please?

    Thanks!
    Maria

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,620

    Re: Use variable column reference in VBA worksheet function

    Maria

    How does the column change based on the active sheet?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    06-25-2014
    Location
    Michigan, US
    MS-Off Ver
    2010
    Posts
    8

    Re: Use variable column reference in VBA worksheet function

    Norie,

    The following sheet requires the following column.

    So if the 3rd sheet is active it references $T:$T, if its the 4th it references $U:$U and so on.

+ 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. Macro with variable reference to the worksheet tab
    By tuph in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-16-2014, 10:23 PM
  2. OFFSET function - column reference over the edge of the worksheet
    By ronaldev in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-04-2013, 10:09 PM
  3. Replies: 2
    Last Post: 10-06-2009, 04:32 AM
  4. Vlookup with variable worksheet reference
    By trempnvt in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-23-2006, 01:50 PM
  5. how to reference a worksheet with a variable vs a name
    By ibbm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-17-2006, 03:00 PM

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