Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default delete the non blank rows depending on Column

Hello

I need some help with this please. I would like to create a Marco that will
help me delete the non blank rows depending on Column C. For example, a Marco
will delete everything except Row 2 Column C and Row 4 Column C. Since Column
C for those 2 rows is blank it will not delete.

A B C
1 meeting Yes 20
2 meeting Yes
3 meeting Yes 10
4 meeting Yes
5 meeting Yes 100

So after the Macro, it should look something like this

A B C
1 meeting Yes
2 meeting Yes

Thank you very much

Harn

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default delete the non blank rows depending on Column

Hi,

Right click your sheet tab, view code and paste this in and run it.

Sub stance()
Dim MyRange As Range
Dim DelRange As Range
Lastrow = Cells(Cells.Rows.Count, "C").End(xlUp).Row
Set MyRange = Range("C1:C" & Lastrow)
For Each C In MyRange
If Not IsEmpty(C) Then
If DelRange Is Nothing Then
Set DelRange = C.EntireRow
Else
Set DelRange = Union(DelRange, C.EntireRow)
End If
End If
Next
DelRange.delete
End Sub


Mike

"Harn88" wrote:

Hello

I need some help with this please. I would like to create a Marco that will
help me delete the non blank rows depending on Column C. For example, a Marco
will delete everything except Row 2 Column C and Row 4 Column C. Since Column
C for those 2 rows is blank it will not delete.

A B C
1 meeting Yes 20
2 meeting Yes
3 meeting Yes 10
4 meeting Yes
5 meeting Yes 100

So after the Macro, it should look something like this

A B C
1 meeting Yes
2 meeting Yes

Thank you very much

Harn

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 to delete rows if cell blank in column puiuluipui Excel Discussion (Misc queries) 4 October 15th 09 05:22 PM
Delete Blank Rows - specify column via dialog porter444 Excel Programming 1 November 30th 07 05:45 PM
Delete Rows if any cell in Column H is blank but do not Delete Fir manfareed Excel Programming 4 September 28th 07 05:20 PM
Delete entire rows where there is a blank in column A Chris Hankin[_2_] Excel Programming 7 June 11th 06 09:56 AM
To Delete the specific rows when blank is found on column A ddiicc Excel Programming 3 August 5th 05 05:32 AM


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