I think that Macro will work! But.... Could you make it so that it only searches and selects columns within a range of highlighted columns? It picked out all the columns I want to delete, but it also included some columns outside the column range I want to keep. thanks! ......Or if not that, maybe only search columns higher (to the right) of "X"?In any case Try this macro:
VBA Code:Sub selectcolumns() Dim j As Long Dim rng As Range For j = 1 To Cells(1, Columns.Count).End(1).Column If Not (Cells(1, j).Text Like "*:00*" Or Cells(1, j).Text Like "*:30*") Then If rng Is Nothing Then Set rng = Cells(1, j) Else Set rng = Union(rng, Cells(1, j)) End If Next If Not rng Is Nothing Then rng.EntireColumn.Select End Sub
Please include all those details from the original post.maybe only search columns higher (to the right) of "X"?
Sub selectcolumns()
Dim j As Long
Dim rng As Range
For j = Columns("Y").Column To Cells(1, Columns.Count).End(1).Column
If Not (Cells(1, j).Text Like "*:00*" Or Cells(1, j).Text Like "*:30*") Then
If rng Is Nothing Then Set rng = Cells(1, j) Else Set rng = Union(rng, Cells(1, j))
End If
Next
If Not rng Is Nothing Then rng.EntireColumn.Select
End Sub
I think that will work PERFECT! I'll spend some time reviewing and working on it now. But it looks great. Thanks so much!Please include all those details from the original post.
Try this
VBA Code:Sub selectcolumns() Dim j As Long Dim rng As Range For j = Columns("Y").Column To Cells(1, Columns.Count).End(1).Column If Not (Cells(1, j).Text Like "*:00*" Or Cells(1, j).Text Like "*:30*") Then If rng Is Nothing Then Set rng = Cells(1, j) Else Set rng = Union(rng, Cells(1, j)) End If Next If Not rng Is Nothing Then rng.EntireColumn.Select End Sub
The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.I think that will work PERFECT! I'll spend some time reviewing and working on it now. But it looks great.