I have a single tab worksheet that has a button on it (with the code embedded in that tab - not personal.xls) that I copy into other workbooks to use. But the problem was that the button kept looking for the macro in the original file and not the new file. Basically it's like a relative reference vs absolute macro reference. I would have to keep editing the button to point it to the correct tab macro. However, I tried making the tab again and insert it into a new sheet and the button is performing with relative reference as apposed to absolute reference. My question is what did I do to fix it???
Thanks in advance,
Grez
Private Sub GetTabAndHeaderNames()
Dim sht As Worksheet
Dim DHCSht As Worksheet
'Pulls Tab Names and the Data Column headers from each tab so they can all be compared to each other for consistency.
'ActiveWorkbook.Cells.ClearContents
Sheets("Data Header Check").Cells.ClearContents 'NEED TO FIGURE OUT HOW TO REFER TO THE SHEET THAT THE CODE IS PLACED IN SO THE SHEET NAME IS NOT HARD CODED
n = 1 'STARTING COLUMN FOR HEADER OUTPUT
For i = 1 To Worksheets.Count 'THIS EXCLUDES CHART TABS
Set wrksht = Worksheets.Item(i)
' If (Sheets(i).Type = -4167) Then 'TYPE -4167 EQUAL WORKSHEET TAB, -4169 = CHART TABS
Select Case wrksht.Name
Case "GetSet"
' DO NOTHING
Case "Data Header Check"
' DO NOTHING
Case Else
Range("TabNameRow").Columns(n) = wrksht.Name
wrksht.Rows(6).Copy
Range("HeaderRow").Columns(n).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
n = n + 1
End Select
Next i
Range("A1").Select
End Sub
Sub GetHeadersButton_Click()
GetTabAndHeaderNames
End Sub
Bookmarks