ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Conditional Formatting - Inserting Rows (https://www.excelbanter.com/excel-worksheet-functions/257796-conditional-formatting-inserting-rows.html)

Danny

Conditional Formatting - Inserting Rows
 
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,

ryguy7272

Conditional Formatting - Inserting Rows
 
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

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Danny" wrote:

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,



All times are GMT +1. The time now is 09:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com