View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mark Mark is offline
external usenet poster
 
Posts: 989
Default Change Background Color on PivotTable subtotal row

I found a way to do this, though I wouldn't consider it particularly
eloquent, in that it uses On Error GoTo..

If anyone knows of a better way, please do let me know.

But, this works:

'**************
Sub test()

Dim i As Integer

On Error GoTo check_next_cell:

For i = 1 To ActiveSheet.UsedRange.Rows.Count Step 1

If Cells(i, 1).PivotCell.PivotCellType = xlPivotCellSubtotal Then

Cells(i, 1).Interior.ColorIndex = 15

End If
check_next_cell:
Next i
On Error GoTo 0

End Sub