+ Reply to Thread
Results 1 to 3 of 3

Reference Variable Sheet in macro

  1. #1
    Registered User
    Join Date
    01-09-2006
    Posts
    16

    Reference Variable Sheet in macro

    I have used coding similar to the following before:
    Please Login or Register  to view this content.

    However, in this instance, my sheet is a variable (strSheet) and I can't quite get the syntax right. So far, I have tried the following to no avail:
    Please Login or Register  to view this content.
    Any help would be greatly appreciated!
    Last edited by VBA Noob; 04-12-2007 at 03:02 PM.

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    if strSheet is a string variable

    Please Login or Register  to view this content.
    should do you good.

  3. #3
    Registered User
    Join Date
    01-09-2006
    Posts
    16
    Thanks! That worked with one minor adjustment (my sheet is always more than one word so I needed single quotes in there as well).

    I ended up with:

    ActiveCell.FormulaR1C1 = "='" & strSheet & "'!R[3]C[3]"

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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