Deleting an entire row depending on the colour shading present

  • Thread starter Thread starter Vipul Vij
  • Start date Start date
V

Vipul Vij

Hi all,

I need to be able to delete entire rows that have no shading and keep
those that have a specific colouring. Any help would be appreciated.

Regards,

Vipul
 
don't know how many ros and column you have. The code defines an area
bounded by the last items in Row 1 and Column A.

Sub removeshade()

LastRow = Cells(Rows.Count, "A").End(xlUp).Row
LastCol = Cells(1, Columns.Count).End(xlToLeft).Column

Set myrange = Range(Cells(1, 1), Cells(LastRow, LastCol))

For Each cell In myrange

If cell.Interior.ColorIndex <> xlNone Then
cell.EntireRow.Delete Shift:=xlUp

End If
Next cell

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

Back
Top