I got this code from another question about deleting columns, but instead of deleting the selected columns, I would like to delete every other column if that's possible.
Sub RemoveCols()
Dim ibox As String, arr As Variant, i As Long, col As Variant
ibox = InputBox("Enter column headers to delete separated by commas", "Headers")
If Len(ibox) = 0 Then
Exit Sub
Else
arr = Split(ibox, ",")
For i = LBound(arr) To UBound(arr)
With ActiveSheet
col = Application.Match(Trim(arr(i)), .Rows(1), 0)
If IsNumeric(col) Then
.Columns(col).Delete Shift:=xlToLeft
End If
End With
Next i
End If
End Sub
Sub RemoveCols()
Dim ibox As String, arr As Variant, i As Long, col As Variant
ibox = InputBox("Enter column headers to delete separated by commas", "Headers")
If Len(ibox) = 0 Then
Exit Sub
Else
arr = Split(ibox, ",")
For i = LBound(arr) To UBound(arr)
With ActiveSheet
col = Application.Match(Trim(arr(i)), .Rows(1), 0)
If IsNumeric(col) Then
.Columns(col).Delete Shift:=xlToLeft
End If
End With
Next i
End If
End Sub