+ Reply to Thread
Results 1 to 4 of 4

use a string to reference a sheet

Hybrid View

  1. #1
    Registered User
    Join Date
    06-16-2008
    Posts
    18

    use a string to reference a sheet

    hello

    Thanks again to everyone for all their help. The atatched sheet should show what I'm looking for pretty well, but here's my problem:

    I have a summary sheet that has a column called "sheet name" for about 5000 sheets, then another colum for the "total" cell in each of those sheets. I would like to do a standard ='sheet'!D5 type reference, except use the value in the name column as the sheet name in my reference.

    Something like

    =' & A2 & '!D5
    =' & A3 & '!D5
    =' & A4 & '!D5
    =' & A5 & '!D5
    =' & A6 & '!D5

    Reason is: I could just do this formula once, and then fill-down, and everything would be set. Excell would change the A$ part each time.

    This brings me to another problem: Could I get the D5 part to be constant while filling down, while the A$ part changes?
    Attached Files Attached Files

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Try:

    =INDIRECT("'"&A3&"'!D5")

    copied down
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    06-16-2008
    Posts
    18

    Perfect!!!

    Thanks! That works great!

  4. #4
    Forum Contributor
    Join Date
    04-24-2007
    Location
    NYC
    MS-Off Ver
    2k3/2k7/2010
    Posts
    270
    Dim i As Long
    Dim i2 As Long
    i = 3
    'Check to see if this is fresh.
    Do While ThisWorkbook.Sheets("SUMMARY").Cells(i, 1).Value <> ""
    i = i + 1
    Loop
    i2 = i
    'Set's the starting row for summation
    Dim ws As Worksheet
        For Each ws In Worksheets
        If ws.Name <> "SUMMARY" Then
        ThisWorkbook.Sheets("SUMMARY").Cells(i, 1).Value = ws.Name
        ThisWorkbook.Sheets("SUMMARY").Cells(i, 2).Formula = "='" & ws.Name & "'!D5"
        i = i + 1
        Else
        End If
        Next
        
    ThisWorkbook.Sheets("SUMMARY").Cells(i, 1).Value = "TOTAL:"
    ThisWorkbook.Sheets("SUMMARY").Cells(i, 2).Formula = "=sum(" & Cells(i2, 2).Address & ":" & Cells(i - 1, 2).Address & ")"

    This will will check all the worksheets in your workbook, and put the reference

+ 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