LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 265
Default Auto Deletion of 4 consecutive rows out of every 5

Sub DeletingAllButFifth()
Dim a As Double
Dim b As Integer
a = 1
While a < 1000
b = 1
While b < 5
Rows(a).Delete
b = b + 1
Wend
a = a + 1
Wend
End Sub

'remember that in: "While a < 1000" the 1000 number means the total rows in
your
'sheet change it to a number you want

HTH

"scratching my head" wrote:

I have a spreadsheet in which 4 of every 5 Rows need to be deleted. ie: Row
1 is good, Row 6 is good, Row 11 is good, Row 16 is good, etc. I need to
delete Rows 2-5, 7-10, 12-15, etc. I would prefer to set a variable in the
macro to tell it how many sets of 4 consecutive rows I need deleted (with one
good row between each bad set of 4). The rows that need to be deleted are not
entirely blank, some of the cells have data (not needed) but there are a few
rows that are entirely blank. It needs to delete the rows irreguardless of
any data in that row. Help is appreciated as I am not a programmer but you
guys are really good.

OR

Every 5th cell in column A has data. I need to delete all ROWS that have no
data in COLUMN A(even if it is a "space" that was used to delete previous
data) in column A. How would it know when it reached the end of the data and
continue to delete the balance of the blank spreadsheet?

Thanks
Danny


 
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
"Cross"-Auto filling: consecutive columns into rows AndreasW Excel Worksheet Functions 1 October 19th 09 01:46 PM
Transposing data from consecutive rows into non-consecutive rows econ Excel Discussion (Misc queries) 0 March 10th 08 07:24 PM
auto summarizing consecutive groups of rows Mikap New Users to Excel 0 September 18th 07 04:02 AM
Row deletion and auto filter RMJames Excel Discussion (Misc queries) 0 March 15th 06 10:09 AM
Auto Deletion of certain Rows in a spreadsheet scratching my head Excel Programming 7 June 8th 05 04:12 AM


All times are GMT +1. The time now is 10:37 AM.

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

About Us

"It's about Microsoft Excel"