I have an excel file with 430 columns and I need to loop through columns 28-32 39-56 60-71 89-268 276-291 323-396 416-418 420-429
For that purpose, I am creating an array, but I don't how I can assign all values between each bounds. The array should contain the values 28, 29, 30, 31, 32, 39, 40,...
and so on.
I've been looking, but I might not be using the correct keywords. Any help would be greatly appreciated.
CodePudding user response:
Rather than using an array, one alternative might be to use Select Case
, something like this:
Sub tester()
Dim col As Range
For Each col In ActiveSheet.Range("AB:PM").Columns
Select Case col.Column
Case 28 To 32, 39 To 56, 60 To 71 ' and so on
' Process col here
End Select
Next
End Sub