Forum Discussion
PaddyB
Aug 16, 2022Brass Contributor
PowerQuery remove Columns
Hi Guys is there an uncomplicated way to remove an "unknown number" of columns? for example, all what start with "column.01, column.02, column.03" and so on for example with column.0* 1. i ne...
OliverScheurich
Aug 16, 2022Gold Contributor
Sub columnsdelete()
Dim i As Long
For i = 1 To 9
If Cells(1, i).Value Like "column.0*" Then
Columns(i).Delete
i = i - 1
Else
End If
Next i
End Sub
An alternative could be this code. In the attached sample file you can click the button in cell F2 to run the macro. The code can easily be adapted to other ranges.