decadence
Well-known Member
- Joined
- Oct 9, 2015
- Messages
- 525
- Office Version
- 365
- 2016
- 2013
- 2010
- 2007
- Platform
- Windows
Hi, I would like to delete rows where the rows don't contain any color, however I have a lot of data to delete so I what I want to do is step through the data and add the rows to an array/collection that don't contain any color then delete them all at once, currently I can do it one row at a time however it takes a long time to do. I can't filter on color as different cells in the rows may or may not contain color. I can have up to 10,0000 rows of data and could end up deleting 9,999 if no cells have any colour in them. can someone help please
The code I am using
The code I am using
VBA Code:
Sub DeleteNonColor()
Dim iCntr As Long
Dim Rng As Range
Set Rng = ActiveSheet.UsedRange
For iCntr = Rng.Column + Rng.Rows.count - 1 To Rng.row Step -1
If Not Cells(iCntr, 1).EntireRow.Interior.ColorIndex = 19 Then Rows(iCntr).EntireRow.Delete
Next
End Sub