LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Delete variable # of rows depending on conditions

Thank you Charles :)
It worked for me :)

"Charles Chickering" wrote:

Pman, if you're trying to leave only one blank row in at a time try something
like this:
Dim cnt as Long
Dim MyCell as Range
For cnt = 503 to 2 Step -1
Set MyCell = Range("B" & cnt)
If MyCell = "" and MyCell.Offset(-1) = "" Then MyCell.EntireRow.Delete
Next

--
Charles Chickering

"A good example is twice the value of good advice."


"Pman" wrote:

Hi,

I have a data sheet in which I have written a macro to add up columns upto
row #503. However every month I do not need 503 rows, sometimes its as small
as 20, or sometimes I need all the 503 rows. I was wondering if anyone could
help me figure out as to how to delete rows if more than three consecutive
rows are blank (this is because there is a blank row in between every unique
entity in a cell).
For eg: column "B" has data as follows:
1
1
1

2
2

3

4
4
4








TOTAL

If I use a macro to delete rows, it deletes the rows between the unique
values as well....hence I thought if a macro can be written that can delete
the blank rows till my total.

Thanks in Advance.....and Thanks to everyone who has helped me in the past :)

P

 
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
how to write to macro to only delete rows under certain conditions cazaril Excel Programming 2 September 6th 07 04:26 PM
Delete rows depending on cell Value Tomas Stroem Excel Programming 3 June 8th 07 10:36 AM
How to delete a set of rows depending on Value msbutton27 Excel Discussion (Misc queries) 1 January 15th 06 04:57 PM
Insert rows in depending on criteria in variable columns jeffbert Excel Programming 2 October 4th 04 06:53 PM
Delete all Rows in a Variable Range John[_78_] Excel Programming 3 June 30th 04 06:13 PM


All times are GMT +1. The time now is 04:53 PM.

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"