i Have 700 columns in a sheet. I want to delete more than 650 out of them. If I use range as A:W
and more then I get 400 Error
.
Is there any limit to no. of column deletion in VBA.
i Have 700 columns in a sheet. I want to delete more than 650 out of them. If I use range as A:W
and more then I get 400 Error
.
Is there any limit to no. of column deletion in VBA.
Loop through them from rightmost column and delete them one by one.
Sub test()
Dim c As Long, r As Long
Worksheets(1).Activate
'populate 700 columns
For c = 1 To 700
Cells(1, c).Value = "col " & c
For r = 2 To 10
Cells(r, c).Value = "hej " & c & "/" & r
Next
Next
'remove e.g. even columns
For c = 700 To 1 Step -2
Columns(c).Select
Selection.Delete Shift:=xlToLeft
Next
End Sub