Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to delete or insert a worksheet. dmarten Excel Discussion (Misc queries) 2 October 31st 06 05:03 PM
IF statements - use to insert/delete rows? WRM Excel Worksheet Functions 5 October 21st 06 08:55 PM
Automatically insert/delete rows to be x apart Mr_Flibble Excel Discussion (Misc queries) 5 February 17th 06 04:04 AM
Keep cells in two different workbooks linked after delete/insert r KarenM Excel Worksheet Functions 0 September 22nd 05 05:41 PM
can't insert, delete or move pictures parker Excel Discussion (Misc queries) 1 February 18th 05 01:03 AM


All times are GMT +1. The time now is 06:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"