ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete Every 2nd & 3rd Row (https://www.excelbanter.com/excel-programming/374073-re-delete-every-2nd-3rd-row.html)

Robert McCurdy

Delete Every 2nd & 3rd Row
 
The sequel?

Sub SpeedII()
With ActiveSheet.UsedRange
With .Columns(.Columns.Count + .Column + 1)
.Formula = "=1/n(1+mod(row(a1),3)=2)"
.SpecialCells(xlCellTypeFormulas, xlErrors).EntireRow.Delete
.Value = ""
End With
End With
End Sub


Regards
Robert McCurdy

"excelent" wrote in message ...
The sub looks in column A for the last row with values
Then it use column IV temporary - i ges u dont use that one :-)
try on a copy of ur sheet first, just in case

Sub Speed()
r = Cells(65536, 1).End(xlUp).Row ' if not col.A change '1' to right one
For t = 4 To r Step 3
Cells(t, 256) = 1
Next
Range("IV2:IV" & r).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Range("IV2:IV" & r) = ""
End Sub



"Mickey" skrev:

Hi,
I need to find a quicker way to delete every 2nd & 3rd row of three rows.
e.g. Delete Row 2 & 3, then 3 & 4, then 4 & 6. Can anyone help?, The below
does it but requires me to add a statement for each set of three rows, as
the data can vary from 3 rows to several thousand, I need something more
automatic.

Sub Macro1()
'
'
Rows("2:3").Select
Selection.Delete Shift:=xlUp
Rows("3:4").Select
Selection.Delete Shift:=xlUp
Rows("4:5").Select
Selection.Delete Shift:=xlUp
End Sub




Mickey

Delete Every 2nd & 3rd Row
 
Thanks Robert,

Mickey




All times are GMT +1. The time now is 05:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com