Column Delete based on String
Hi
Found this thread very interestiing. Am complete novice at programming,
have tried this coding and it works for me, but I cannot then re-instate the
columns. Is it possible to HIDE the columns, which can be then be un-hidden?
Thanks
"scott" wrote:
I'm desperately tring to delete a column if a cell within a range equals
"TESTING". Below gives error "Method 'Range' of Object '_Global' failed". I
also need this selection to auto set to A1 to last non-blank cell on row 1.
The cell coloring line works and is just there so I know I'm on the right
cell.
Any help in fixing these 2 actions may save a lot of gray hair.
Sub testSelectDelete()
Dim cell As Range
For Each cell In Selection
If Not IsEmpty(cell) And cell.Value = "TESTING" Then
cell.Interior.Color = RGB(255, 255, 192)
Range(cell).EntireColumn.Delete
End If
Next
End Sub
|