Hey all!
How do I delete columns that have a color fill in them/ if the entire column is highlighted. Currently I am doing it by specifying the column names, but I was wondering if this could be done dynamically.
Thanks
Hey all!
How do I delete columns that have a color fill in them/ if the entire column is highlighted. Currently I am doing it by specifying the column names, but I was wondering if this could be done dynamically.
Thanks
This will delete ALL columns that have a coloured cell in them:
[VBA]Sub cols()
Dim MyCell As Range
For Each MyCell In ActiveSheet.UsedRange
If MyCell.Interior.ColorIndex <> xlNone Then
MyCell.EntireColumn.Delete
End If
Next
End Sub[/VBA]
Regards,
Simon
Please read this before cross posting!
In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
If I have seen further it is by standing on the shoulders of giants.
Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)
Simon Lloyd aka Simon The Legend. Your code works perfectly, thank you very much sir!
Glad i could help, please mark the thread solved by going to thread tools and then Mark Solved
Regards,
Simon
Please read this before cross posting!
In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
If I have seen further it is by standing on the shoulders of giants.
Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)