Hi, I'm new to Excel VBA. I have been struggling to get the first row and column of my Pivot Table. Please assist on this subject. Thank you!
Private Sub firstCOLROW_Click()
Dim pt As PivotTable
Dim firstRow As Long, firstCol As Long
Set pt = ThisWorkbook.Sheets("Nevada Chart").PivotTables(1)
firstRow = Sheet8.PivotTables(1).TableRange1.Row
firstCol = Sheet8.PivotTables(1).TableRange1.Column
MsgBox firstRow
MsgBox firstCol
End Sub
This code only provides the row and column of the Data Field. Please assist in order to get the first row and column of the first value(data) to appear in the Pivot Table.
Private Sub firstCOLROW_Click()
Dim pt As PivotTable
Dim firstRow As Long, firstCol As Long
Set pt = ThisWorkbook.Sheets("Nevada Chart").PivotTables(1)
firstRow = Sheet8.PivotTables(1).TableRange1.Row
firstCol = Sheet8.PivotTables(1).TableRange1.Column
MsgBox firstRow
MsgBox firstCol
End Sub
This code only provides the row and column of the Data Field. Please assist in order to get the first row and column of the first value(data) to appear in the Pivot Table.