I'm trying to create a macro that will find the yellow lines (subtotal lines) and will insert a blank line (no interior color) above and below it. Following is my code, can someone help me find the error of my ways?????
Sub Insert_Blank_Rows()
'
' Insert_Blank_Rows before and after total line in Elabor Budgets
' Macro recorded 1/19/2005 by Pitney Bowes Inc.
'
Dim Cell As Range
Dim r As Range
Set r = Range("E11", Range("E65536").End(xlUp))
For Each Cell In r
If Cell.Interior.ColorIndex = 36 Then
Cell.Offset(1).Interior.ColorIndex = 0
Cell.Offset(1).ClearContents
Cell.Offset(-1).Interior.ColorIndex = 0
Cell.Offset(-1).ClearContents
End If
Next
End Sub
Thank you for your time and expertise.
Sub Insert_Blank_Rows()
'
' Insert_Blank_Rows before and after total line in Elabor Budgets
' Macro recorded 1/19/2005 by Pitney Bowes Inc.
'
Dim Cell As Range
Dim r As Range
Set r = Range("E11", Range("E65536").End(xlUp))
For Each Cell In r
If Cell.Interior.ColorIndex = 36 Then
Cell.Offset(1).Interior.ColorIndex = 0
Cell.Offset(1).ClearContents
Cell.Offset(-1).Interior.ColorIndex = 0
Cell.Offset(-1).ClearContents
End If
Next
End Sub
Thank you for your time and expertise.