Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Try this.
Sub DeleteAll_colored() Dim RowNdx As Long Dim LastRow As Long LastRow = ActiveSheet.UsedRange.Rows.Count For RowNdx = LastRow To 1 Step -1 If Cells(RowNdx, "A").Interior.ColorIndex < xlNone Then Rows(RowNdx).Delete End If Next RowNdx End Sub Gord Dibben MS Excel MVP On Wed, 7 Nov 2007 22:39:02 -0800, climate wrote: Hi thank's ryguy7272 1- My colored cells have different color(green,yellow,....). 2- your macro work's cell to cell, not for entire columns,please response to these questions. regards "ryguy7272" wrote: Hummm, similar post earlier this morning... I think this will give you what you want: Sub DeleteAllUncolored() Dim ClrRng As Range Set ClrRng = Range("A1", Range("A5000").End(xlUp)) For Each cell In ClrRng If cell.Interior.ColorIndex = 3 Then cell.EntireRow.Delete End If Next cell End Sub This assumes that cells are colored red!! This site is great to see which numbers correspond to which colors in Excel: http://www.mvps.org/dmcritchie/excel/colors.htm As always, be extremely careful when deleting date; try this macro on a sample before you execute on your actual data. Regards, Ryan-- -- RyGuy "climate" wrote: Hi I have 2 columns that many of it's rows has colored ( colored cells in first and second column is equal) , i want to remove colored rows. Would you please help me? regards climate |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I remove Duplicate rows? | Excel Discussion (Misc queries) | |||
How do I remove empty Rows | Excel Discussion (Misc queries) | |||
How to remove a lot of rows? Please help | Excel Discussion (Misc queries) | |||
count colored rows | Excel Discussion (Misc queries) | |||
sort according to the colored rows | Excel Discussion (Misc queries) |