Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am looking to have a macro delete 2 rows then skip 1 row and delete
the next two. I have over 18,000 rows and I really would rather not do this the manual way. :) Thanks, Jared |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I know you said you wanted a macro, but if you are only doing this once, it
only takes 30 seconds to do it manually: - Add a helper column - In the 1st three cells of that column enter A, B, C. - Copy those 3 cells down the length of your data - Sort on the Helper column. - Delete A's & B's HTH, -- George Nicholson Remove 'Junk' from return address. "jared" wrote in message oups.com... I am looking to have a macro delete 2 rows then skip 1 row and delete the next two. I have over 18,000 rows and I really would rather not do this the manual way. :) Thanks, Jared |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub DeleteRows()
Columns(1).Insert Range("A1:A18500").Formula = "=if(mod(row(),3)=0,""Keep"",na())" set rng = Columns(1).SpecialCells(xlFormulas,xlErrors).Entir eRow.Delete columns(1).Delete End Sub -- Regards, Tom Ogilvy "jared" wrote in message oups.com... I am looking to have a macro delete 2 rows then skip 1 row and delete the next two. I have over 18,000 rows and I really would rather not do this the manual way. :) Thanks, Jared |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jared,
This might be what you want Sub Test() Dim iLastRow As Long Dim i As Long iLastRow = Cells(Rows.Count, "A").End(xlUp).Row If iLastRow Mod 3 < 1 Then iLastRow = iLastRow - 1 If iLastRow Mod 3 < 1 Then iLastRow = iLastRow - 1 For i = iLastRow To 1 Step -3 Rows(i).Resize(2).Delete Next i End Sub -- HTH Bob Phillips (remove nothere from email address if mailing direct) "jared" wrote in message oups.com... I am looking to have a macro delete 2 rows then skip 1 row and delete the next two. I have over 18,000 rows and I really would rather not do this the manual way. :) Thanks, Jared |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Quick Macro question - How to delete two rows then skip one - and repeat | Excel Discussion (Misc queries) | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
How to delete rows when List toolbar's "delete" isnt highlighted? | Excel Worksheet Functions | |||
Delete every 3rd row, then delete rows 2-7, move info f/every 2nd row up one to the end and delete the row below | Excel Programming |