Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
MYR MYR is offline
external usenet poster
 
Posts: 2
Default deleting rows with blank cells after a specified column?

Hello. I have a question regarding row deletion. Is there a macro
that allows me to delete entire rows if all cells beyond a specified
column are blank?

For example, if cells in row 5 are all blank after column C, how do I
delete that entire row (and all rows like that in the entire
spreadsheet)? If there is data in any one or more cells after column
C, I do not wish to remove that row. I appreciate your help.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default deleting rows with blank cells after a specified column?

This should do it. I have included line continuatin character (space and
underscore) for one lines

Sub countcplus()
lr = Cells.Find("*", Cells(Rows.Count, _
Columns.Count), , , xlByRows, xlPrevious).Row
For i = lr To 1 Step -1
If Cells(i, Columns.Count).End(xlToLeft).Column _
< 4 Then Rows(i).Delete
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"MYR" wrote in message
...
Hello. I have a question regarding row deletion. Is there a macro
that allows me to delete entire rows if all cells beyond a specified
column are blank?

For example, if cells in row 5 are all blank after column C, how do I
delete that entire row (and all rows like that in the entire
spreadsheet)? If there is data in any one or more cells after column
C, I do not wish to remove that row. I appreciate your help.


  #3   Report Post  
Posted to microsoft.public.excel.misc
MYR MYR is offline
external usenet poster
 
Posts: 2
Default deleting rows with blank cells after a specified column?

On Jan 9, 11:34*am, "Don Guillett" wrote:
This should do it. I have included line continuatin character (space and
underscore) for one lines

Sub countcplus()
lr = Cells.Find("*", Cells(Rows.Count, _
Columns.Count), , , xlByRows, xlPrevious).Row
For i = lr To 1 Step -1
If Cells(i, Columns.Count).End(xlToLeft).Column _
< 4 Then Rows(i).Delete
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"MYR" wrote in message

...

Hello. *I have a question regarding row deletion. *Is there a macro
that allows me to delete entire rows if all cells beyond a specified
column are blank?


For example, if cells in row 5 are all blank after column C, how do I
delete that entire row (and all rows like that in the entire
spreadsheet)? *If there is data in any one or more cells after column
C, I do not wish to remove that row. *I appreciate your help.


Yes! That worked perfectly. Thanks for your time.

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 HELP - deleting rows containing a range of blank cells DavidHawes Excel Discussion (Misc queries) 9 February 26th 07 03:40 PM
Deleting blank rows Yvette Excel Worksheet Functions 3 June 9th 06 10:30 AM
Deleting Blank Rows Reeni New Users to Excel 4 December 15th 05 01:56 AM
Deleting blank cells in a column KatyLady Excel Discussion (Misc queries) 6 May 30th 05 03:47 PM
Deleting rows with blank cells Batman Excel Worksheet Functions 10 February 16th 05 06:01 PM


All times are GMT +1. The time now is 09:29 PM.

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"