D
Darin Kramer
HI there,
A tough one I think...
I would like to keep column A,B,C.
Then delete Column D,E,F, keep column G
Then delete column h,i,j keep column K
Then delete column l,m,n keep column O, etc etc till I run out of
columns.
I was previously helped with a SIMILAR problem (the movement of the
number of columns was different and the VB below worked for me, however
I dont know how to change it to achieve what I want to achieve above.
Any ideas????
Sub go_delete()
Dim tmp As Integer
Dim tmp2 As Integer
Dim tmp_address As String, row_count As Single
With ActiveSheet.UsedRange
tmp = Fix((.Columns.Count - 5) / 4)
If (.Columns.Count - 5) Mod 4 > 0 Then
tmp = tmp + 1
End If
tmp_address = .Address(False, False)
row_count = .Rows.Count
End With
With ActiveSheet.Range(tmp_address)
With .Offset(0, 5).Resize(row_count, .Columns.Count - 5)
For tmp2 = tmp To 1 Step -1
With .Columns(4 * tmp2 - 3)
.Resize(row_count, 2).EntireColumn.Delete
End With
Next
End With
End With
End Sub
A tough one I think...
I would like to keep column A,B,C.
Then delete Column D,E,F, keep column G
Then delete column h,i,j keep column K
Then delete column l,m,n keep column O, etc etc till I run out of
columns.
I was previously helped with a SIMILAR problem (the movement of the
number of columns was different and the VB below worked for me, however
I dont know how to change it to achieve what I want to achieve above.
Any ideas????
Sub go_delete()
Dim tmp As Integer
Dim tmp2 As Integer
Dim tmp_address As String, row_count As Single
With ActiveSheet.UsedRange
tmp = Fix((.Columns.Count - 5) / 4)
If (.Columns.Count - 5) Mod 4 > 0 Then
tmp = tmp + 1
End If
tmp_address = .Address(False, False)
row_count = .Rows.Count
End With
With ActiveSheet.Range(tmp_address)
With .Offset(0, 5).Resize(row_count, .Columns.Count - 5)
For tmp2 = tmp To 1 Step -1
With .Columns(4 * tmp2 - 3)
.Resize(row_count, 2).EntireColumn.Delete
End With
Next
End With
End With
End Sub