Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
delete every X row, insert everyY row
Hi,
Just wondering is there a formula/code to delete every X th row in a high-lighted range? or to insert a row every Y row? Thanks :) elaine. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
delete every X row, insert everyY row
You could add a formula in an empty column
=MOD(ROW(),2)=0 and then filter that column by a value of TRUE and delete the visible rows. , 2 gives the even rows. Change the ,2 to get other rows as the deletion rows. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) wrote in message ups.com... Hi, Just wondering is there a formula/code to delete every X th row in a high-lighted range? or to insert a row every Y row? Thanks :) elaine. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
delete every X row, insert everyY row
Public Sub DeleteEveryNthRowQuickly(Optional N As Long = 2)
'The default is to delete every 2nd row Application.ScreenUpdating = False On Error Resume Next With ActiveSheet.UsedRange With .Columns(.Columns.Count).Offset(, 1).Cells .Item(N) = True Range(.Item(1), .Item(N)).AutoFill .Cells .SpecialCells(xlConstants).EntireRow.Delete End With End With Application.ScreenUpdating = True End Sub P.S. Awaiting Mr. Phillips' public ridicule. " wrote: Hi, Just wondering is there a formula/code to delete every X th row in a high-lighted range? or to insert a row every Y row? Thanks :) elaine. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Unable to delete or insert a worksheet. | Excel Discussion (Misc queries) | |||
IF statements - use to insert/delete rows? | Excel Worksheet Functions | |||
Automatically insert/delete rows to be x apart | Excel Discussion (Misc queries) | |||
Keep cells in two different workbooks linked after delete/insert r | Excel Worksheet Functions | |||
can't insert, delete or move pictures | Excel Discussion (Misc queries) |