ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting an entire row depending on the colour shading present (https://www.excelbanter.com/excel-programming/389567-deleting-entire-row-depending-colour-shading-present.html)

Vipul Vij

Deleting an entire row depending on the colour shading present
 
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


joel

Deleting an entire row depending on the colour shading present
 
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


"Vipul Vij" wrote:

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




All times are GMT +1. The time now is 05:30 PM.

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