I am trying to build a spreadsheet around some data coming from a pivot table, but I cannot filter and delete rows.
I've tried .Value = .Value
for the table but I am getting the error message
"We can't make this change for the selected cells because it will affect a PivotTable..." (Run-time error '1004')
With ws
FinalRow = .Cells(Cells.Rows.Count, "B").End(xlUp).Row
With .Range("B1:C" & FinalRow)'Pivot table range
.Value = .Value
End With
For iCntr = FinalRow To 1 Step -1
If Rows(iCntr).Hidden Then
Rows(iCntr).EntireRow.Delete
End If
Next iCntr
End With
End With