Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA to delete rows in certain order


I would like to delete rows in certain order in a MS Excel workshee
using VBA ONCE:-

Row 1 to 7
Row 57 to 64
Row 114 to 121
Row 171 to 178
Row 228 to 235
Row 285 to 292
Till the last row of the worksheet.
Any help?

Thank you


Susa

--
chongchingso
-----------------------------------------------------------------------
chongchingsoo's Profile: http://www.excelforum.com/member.php...fo&userid=1633
View this thread: http://www.excelforum.com/showthread.php?threadid=27727

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 212
Default VBA to delete rows in certain order

Hello Susan,

Row 1 to 7 : 7 - 1 = 6 so 7 rows to delete
Row 57 to 64 64 - 57 = 7 so 8 rows to delete


So I assume you meant Row 57 to Row 63, and then Row 113 to 119, 169 to
175 and so on etc.. ?
Please check your seires.

Assuming the series as i mentioned above, you can use following code:

Sub RowDel()
Dim myRowNum As Integer
Dim myRowSet As Integer
Dim myNum As Integer
Dim myMaxRows As Integer
myRowNum = 1
myMaxRows = 3000 'maximum row number you intend to delete.
'care fully set myMaxRows. 65536 which is max. possible rows, will take
lot of time!!
Do While myRowNum <= myMaxRows
myNum = myRowNum
myRowSet = myRowNum + 6
Do While myNum <= myRowSet
Sheet1.Rows(myRowNum).Delete
myNum = myNum + 1
Loop
myRowNum = myRowNum + 49
Loop
End Sub

Sharad

"chongchingsoo" wrote in
message ...

I would like to delete rows in certain order in a MS Excel worksheet
using VBA ONCE:-

Row 1 to 7
Row 57 to 64
Row 114 to 121
Row 171 to 178
Row 228 to 235
Row 285 to 292
Till the last row of the worksheet.
Any help?

Thank you


Susan


--
chongchingsoo
------------------------------------------------------------------------
chongchingsoo's Profile:
http://www.excelforum.com/member.php...o&userid=16338
View this thread: http://www.excelforum.com/showthread...hreadid=277271



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
Hpw do I delete multiple empty rows found between filled rows? Bill Excel Worksheet Functions 2 November 15th 09 07:12 PM
How to Delete empty rows in excel in b/w rows with values Dennis Excel Worksheet Functions 3 August 28th 07 04:15 PM
Cut filtered rows, paste into next empty row of new sheet, and delete cut rows Scott Excel Worksheet Functions 0 December 13th 06 01:25 AM
How to delete rows when List toolbar's "delete" isnt highlighted? Linda Excel Worksheet Functions 1 May 26th 05 08:39 PM
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 Annette[_4_] Excel Programming 2 September 21st 04 02:40 PM


All times are GMT +1. The time now is 05:39 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"