I have a function that loops through all my sheets. Each loop has a loop inside that loops through all tables within the sheet.
I cannot figure out how to get the value of a cell that is directly above the table column headers.
For Each sh In ActiveWorkbook.Worksheets
If ActiveSheet.Name <> sh.Name And Not sh.Name = "Template" Then
For Each tbl In sh.ListObjects
I need those values here
Next tbl
End If
Next sh
You answered your own question (almost):
Option Explicit
Public Sub tblTitle()
Dim sh As Worksheet, tbl As ListObject
For Each sh In ActiveWorkbook.Worksheets
If ActiveSheet.Name <> sh.Name And Not sh.Name = "Template" Then
For Each tbl In sh.ListObjects
With tbl.Range(1, 1)
If .Row > 1 Then MsgBox .Offset(-1, 0)
End With
Next tbl
End If
Next sh
End Sub
For the tables in the image bellow it will show 2 messages: "A" and "B"