Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Howdie,
Can anyone help with VB to do the following: I would like to delete columns F and G, then skip H and I, delete j and k, skip l and m, delete n and o etc So basically starting at F delete two columns, skip two columns, delete two columns etc until no more data in the columns... Thanks guys, appreciate your help Regards D *** Sent via Developersdex http://www.developersdex.com *** |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
For i = 26 To 6 Step -4
Columns(i).Resize(, 2).Delete Next i -- HTH Bob Phillips (remove nothere from email address if mailing direct) "Darin Kramer" wrote in message ... Howdie, Can anyone help with VB to do the following: I would like to delete columns F and G, then skip H and I, delete j and k, skip l and m, delete n and o etc So basically starting at F delete two columns, skip two columns, delete two columns etc until no more data in the columns... Thanks guys, appreciate your help Regards D *** Sent via Developersdex http://www.developersdex.com *** |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Interesting mathematics question. : You should delete from the right to left
instead of from left to right. (in fact, always do this.) Try the macro below. It should work no matter how many columns you've got in the worksheet. Also, it assumes data starts in column A. 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 Regards, Edwin Tam http://www.vonixx.com "Darin Kramer" wrote: Howdie, Can anyone help with VB to do the following: I would like to delete columns F and G, then skip H and I, delete j and k, skip l and m, delete n and o etc So basically starting at F delete two columns, skip two columns, delete two columns etc until no more data in the columns... Thanks guys, appreciate your help Regards D *** Sent via Developersdex http://www.developersdex.com *** |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks Edwin, It works perfectly!!! REgards Darin *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Automatic recognition of a starting point for a column calculation | Excel Worksheet Functions | |||
Select all rows on a sheet from a fixed starting point | Excel Discussion (Misc queries) | |||
bar chart starting point | Charts and Charting in Excel | |||
How do I delete data in a column from a certain point on? | Excel Worksheet Functions | |||
averaging from a fixed point to a non-fixed point? | Excel Programming |