A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Target.PivotCell.PivotRow.Interior.Color = RGB(255, 255, 0)
That's a fake code, PivotRow doesn't exists inside the object model. https://learn.microsoft.com/en-us/office/vba/api/excel.pivotcell#methods
Try the code below.
Andreas.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Here As Range
'In case there is not Pivot table
On Error GoTo Exitpoint
'Find the intersection of the whole Pivot table and the current row/column
Set Here = Union( _
Intersect(Target.EntireRow, Target.PivotTable.TableRange1), _
Intersect(Target.EntireColumn, Target.PivotTable.TableRange1))
'Select it
Application.EnableEvents = False
Here.Select
Target.Activate
Exitpoint:
Application.EnableEvents = True
End Sub