+ Reply to Thread
Results 1 to 4 of 4

using a variable as a sheet reference in an offset function

  1. #1
    Registered User
    Join Date
    10-22-2017
    Location
    ENGLAND
    MS-Off Ver
    2016
    Posts
    35

    using a variable as a sheet reference in an offset function

    I need to change the worksheet in an offset function. The code below works fine if I specify the sheet e.g. sheet1.

    Please Login or Register  to view this content.
    so the code above works fine, but I want to change the sheet so that it is not always sheet 1,
    so I made the sheet as a variable as per the code below:
    Please Login or Register  to view this content.
    this does not work, Please help !

  2. #2
    Valued Forum Contributor than_gold's Avatar
    Join Date
    10-17-2017
    Location
    Coimbatore India
    MS-Off Ver
    Office 365
    Posts
    646

    Re: using a variable as a sheet reference in an offset function

    Since you declaring sht as srting, try this
    ActiveWorkbook.Names("graphdata").RefersTo = "=OFFSET("& sht &"!$EQ$4,COUNT(sht!$EQ:$EQ),0,-$JR$12-1,1)"
    Regards,
    Thangavel D

    Appreciate the help? CLICK *

  3. #3
    Registered User
    Join Date
    10-22-2017
    Location
    ENGLAND
    MS-Off Ver
    2016
    Posts
    35

    Re: using a variable as a sheet reference in an offset function

    Thank you this has worked !

  4. #4
    Valued Forum Contributor than_gold's Avatar
    Join Date
    10-17-2017
    Location
    Coimbatore India
    MS-Off Ver
    Office 365
    Posts
    646

    Re: using a variable as a sheet reference in an offset function

    Happy to help you!!
    You can add rep, if you like my help...

+ 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. Replies: 3
    Last Post: 08-14-2017, 06:26 AM
  2. How to Reference a String in a Way Similar to the OFFSET function
    By smithst3 in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 07-25-2016, 04:08 PM
  3. Offset function with reference cell equal to the value of match function
    By cmurda in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-08-2014, 02:09 PM
  4. Using a variable with the offset function
    By bbatterman in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-05-2013, 03:38 PM
  5. Replies: 16
    Last Post: 12-24-2012, 06:21 AM
  6. Using variable in OFFSET function
    By kmoore in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-22-2011, 12:13 PM
  7. OFFSET function with variable reference cell
    By smile2leksa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2009, 08:32 AM

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