Adding TAB names into formulas

takformaten

Board Regular
Joined
Jan 19, 2004
Messages
75
Hello! I have a workbook, with lots of sheets. I am working on a summary sheet now and need a formula to look up data from the various tabs.

Current Formula is =IF(COUNTIF(TABNAMEONE!$A$7:$A$47,Overview!L6)>0,1,0) I would need in the next column the formula to read =IF(COUNTIF(TABNAMETWO!$A$7:$A$47,Overview!L6)>0,1,0).

Quite naturally I am too lazy to type the tab names manually... but you guys always know how... right?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Not tested.
Code:
Sub VariableSheetNames()
Dim WS As Worksheet
Dim StartRow As Long
'Change to suit
StartRow = 2
For Each WS In ActiveWorkbook.Worksheets
    'Skip the Summary page.
    If WS.Name <> "Summary" Then
        With WS
            'Change Column letter to suit.
            .Range("A" & StartRow).Formula = _
                "=IF(COUNTIF(" & WS.Name & "!$A$7:$A$47,Overview!L6)>0,1,0)"
            StartRow = StartRow + 1
        End With
    End If
Next
 
End Sub
 
Upvote 0
You could do it with INDIRECT.

E.G. =INDIRECT("TabName"&COLUMN()&"!A1")

Placed in column A, COLUMN() returns 1, B = 2, etc.
 
Upvote 0

Forum statistics

Threads
1,216,730
Messages
6,132,404
Members
449,726
Latest member
Skittlebeanz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top