+ Reply to Thread
Results 1 to 4 of 4

Inserting worksheet name as a variable into a function

  1. #1
    Registered User
    Join Date
    08-05-2009
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    5

    Inserting worksheet name as a variable into a function

    Hi, can anyone help?

    I am trying to use a macro to make a simple index page. If I was doing this in a worksheet I would input

    =sheet1!a1

    to take the contents of a1 on sheet 1 and put them into the cell on the index page.

    However, I need to put this formula in where 'sheet1' is a variable defined elsewhere in the macro. I can easily put the value of the cell in, but as the contents change, I want the cells to update, therefoe I need the formula

    I have been trying variations on

    activecell = "=(var1)!a1"

    ' where var1 is the variable of the worksheet name, but it treats var1 as text and not a variable.

    Any help appreciated.

  2. #2
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    764

    Re: Inserting worksheet name as a variable into a function

    Hi
    try "=" & Var1 & "!A1"
    Ravi

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Inserting worksheet name as a variable into a function

    Perhaps you mean

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    08-05-2009
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Inserting worksheet name as a variable into a function

    Thanks, I guessed it was something simple.

+ 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