ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete line if value in column C = "" (https://www.excelbanter.com/excel-programming/302284-delete-line-if-value-column-c-%3D.html)

TheLeafs

Delete line if value in column C = ""
 
Good day,

I have three columns of data in A, B & C. Data exists in column A & B
but in some cells in column C there is no data. I want to delete th
entire row if no data is found in column C. I have very limite
experience in writing macro's. I am wondering if someone can draw u
how I can get this started. The range of the data is from A2:C500.

Thanks for any help

--
Message posted from http://www.ExcelForum.com


Binzelli[_10_]

Delete line if value in column C = ""
 
Hi !

The following code should do the trick:


Sub DeleteEmptyC()

Dim Row As Long
Dim EndRow As Long

Row = 2
EndRow = 500


Do While Row <= EndRow

If IsEmpty(Cells(Row, 3)) Then
Rows(Row).Select
Selection.Delete Shift:=xlUp
'Subtract 1 from Row and EndRow for every row deleted
Row = Row - 1
EndRow = EndRow - 1
End If

Row = Row + 1
Loop

End Sub


Good luck

"TheLeafs " wrote in message
...
Good day,

I have three columns of data in A, B & C. Data exists in column A & B,
but in some cells in column C there is no data. I want to delete the
entire row if no data is found in column C. I have very limited
experience in writing macro's. I am wondering if someone can draw up
how I can get this started. The range of the data is from A2:C500.

Thanks for any help.


---
Message posted from http://www.ExcelForum.com/




Thomas Ramel

Delete line if value in column C = ""
 
Grüezi TheLeafs

TheLeafs schrieb am 23.06.2004

I have three columns of data in A, B & C. Data exists in column A & B,
but in some cells in column C there is no data. I want to delete the
entire row if no data is found in column C. I have very limited
experience in writing macro's. I am wondering if someone can draw up
how I can get this started. The range of the data is from A2:C500.


Use the following line:

Range("C:C").SpecialCells(xlCellTypeBlanks).Entire Row.Delete

--
Regards

Thomas Ramel
- MVP for Microsoft-Excel -

[Win XP Pro SP-1 / xl2000 SP-3]

Gord Dibben

Delete line if value in column C = ""
 
If you don't need to use a macro try this.

Select Column C and EditGo ToSpecialBlanksOK

With all blanks in C selected......

EditDeleteEntire Row.

If you recorded a macro while doing it, you would get basically the same code
as Thomas posted. He has removed a few "select" statements.

Gord Dibben Excel MVP

On Wed, 23 Jun 2004 10:26:31 -0500, TheLeafs
wrote:

Good day,

I have three columns of data in A, B & C. Data exists in column A & B,
but in some cells in column C there is no data. I want to delete the
entire row if no data is found in column C. I have very limited
experience in writing macro's. I am wondering if someone can draw up
how I can get this started. The range of the data is from A2:C500.

Thanks for any help.


---
Message posted from http://www.ExcelForum.com/




All times are GMT +1. The time now is 07:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com