Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 *** Sent via Developersdex http://www.developersdex.com *** |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can make a macro to run evey one hour-automatically | Excel Discussion (Misc queries) | |||
Auto Refresh evey ?? in a linked list | Excel Discussion (Misc queries) | |||
Deleting cells in a column ref a different column | Excel Programming | |||
Deleting a row by a column value | Excel Programming | |||
Deleting a row with 0 in column A | Excel Programming |