Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Deleting Certain Rows

I have a macro that manipulates the data in my spreadsheet. That last thing
I had it do was sort by a certain column. This column contains either blank
cells or the number "92". Now I want the macro to delete all the rows that
contain the blank cells (which are technically starting on Row 2 (after the
header row). How do I get the macro to select and delete up to the row
before where the 92's start?

Thanks

--
Debra Ann
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Deleting Certain Rows

If the cells are really blank, assume column M and M1 is not blank

columns("M").Specialcells(xlblanks).EntireRow.Dele te

if you have formulas in the cells that do something like

=if(condition,92,"")

then you will need to loop
for i = cells(rows.count,"A").End(xlup).row to 2 step -1
if cells(i,"M").Value = "" then
rows(i).Delete
end if
Next

This assumes column A will have data at least in the last used row (where M
might not). change "A" to reflect the column which will satisfy this
requirement
--
Regards,
Tom Ogilvy


"Debra Ann" wrote in message
...
I have a macro that manipulates the data in my spreadsheet. That last

thing
I had it do was sort by a certain column. This column contains either

blank
cells or the number "92". Now I want the macro to delete all the rows

that
contain the blank cells (which are technically starting on Row 2 (after

the
header row). How do I get the macro to select and delete up to the row
before where the 92's start?

Thanks

--
Debra Ann



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
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Setting up and Configuration of Excel 1 November 12th 08 06:05 PM
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Excel Worksheet Functions 1 November 12th 08 01:39 PM
Help!! I have problem deleting 2500 rows of filtered rows!!!! shirley_kee Excel Discussion (Misc queries) 1 January 12th 06 03:24 AM
Help!!! I have problem deleting 2500 rows of filtered rows shirley_kee[_2_] Excel Programming 1 January 12th 06 03:15 AM
deleting hidden rows so i can print only the rows showing?????? jenn Excel Worksheet Functions 0 October 6th 05 04:05 PM


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