Conditional Formatting - Inserting Rows

D

Danny

Hi,

Is there a way that when you insert rows, the conditional formatting on the
adjacent rows does not copy into the inserted/new row?

Thanks,
 
R

ryguy7272

Here are tow ways of inserting a row when the text changes in Column A (I
don't know why you are inserting rows).

Sub InsertRow_At_Change()
Dim LastRow As Long
Dim x As Long
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
Application.ScreenUpdating = False

For x = LastRow To 3 Step -1
If Cells(x, 1).Value <> Cells(x - 1, 1).Value Then
If Cells(x, 1).Value <> "" Then
If Cells(x - 1, 1).Value <> "" Then
Cells(x, 1).EntireRow.Insert Shift:=xlDown
End If
End If
End If
Next x

Application.ScreenUpdating = True
End Sub

Sub InsertAfterTextChange()
Do Until ActiveCell = Empty And ActiveCell.Offset(1) = Empty
If ActiveCell <> ActiveCell.Offset(1) And ActiveCell <> Empty And
ActiveCell.Offset(1) <> Empty Then
ActiveCell.Offset(1).EntireRow.Insert
ActiveCell.Offset(2).Select
Else
ActiveCell.Offset(1).Select
End If
Loop
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top