![]() |
Removal red rows in excel
Lets say I have an excel spreadsheet file that consists of a number rows with
text, each of which is painted in either of two colors: green or red. I want to remove those rows that colored in red. how can I do this? |
Removal red rows in excel
Hi Jimmy,
Try: '================ Public Sub Tester() Dim WB As Workbook Dim SH As Worksheet Dim rng As Range Dim LastRow As Long Dim rCell As Range Dim delRng As Range Set WB = ActiveWorkbook '<<===== CHANGE Set SH = WB.Sheets("Sheet1") '<<===== CHANGE LastRow = Cells(Rows.Count, "A").End(xlUp).Row Set rng = SH.Range("A1:A" & LastRow) For Each rCell In rng.Cells With rCell If .Interior.ColorIndex = 3 Then If delRng Is Nothing Then Set delRng = rCell Else Set delRng = Union(rCell, delRng) End If End If End With Next rCell If Not delRng Is Nothing Then delRng.EntireRow.Delete End If End Sub '<<================ --- Regards, Norman "Jimmy Ionic" wrote in message ... Lets say I have an excel spreadsheet file that consists of a number rows with text, each of which is painted in either of two colors: green or red. I want to remove those rows that colored in red. how can I do this? |
All times are GMT +1. The time now is 12:02 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com