ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro for Deleting rows with balnk cell (https://www.excelbanter.com/excel-programming/443027-macro-deleting-rows-balnk-cell.html)

Radhakant Panigrahi

Macro for Deleting rows with balnk cell
 
Hi,

i have several data in a sheet with data in 10 columns...

in column A there are cells where it is blank and i want to delete the rows
where there is blank cell in column A..
I need the vba macro for this

regards,
radha

Ron de Bruin

Macro for Deleting rows with balnk cell
 
Try

Sub DeleteBlankRows_2()
'This macro delete all rows with a blank cell in column A
'If there are no blanks or there are too many areas you see a MsgBox
Dim CCount As Long
On Error Resume Next

With Columns("A") ' You can also use a range like this Range("A1:A8000")
CCount = .SpecialCells(xlCellTypeBlanks).Areas(1).Cells.Cou nt
If CCount = 0 Then
MsgBox "There are no blank cells"
ElseIf CCount = .Cells.Count Then
MsgBox "There are more then 8192 areas"
Else
.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End If
End With

On Error GoTo 0
End Sub

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm



Gord Dibben

Macro for Deleting rows with balnk cell
 
Turn on macro recorder.

Select column A and F5SpecialBlanksOK

EditDelteEntire row.

The recorder gives you this.

Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.EntireRow.Delete


Gord Dibben MS Excel MVP

On Wed, 2 Jun 2010 08:00:01 -0700, Radhakant Panigrahi
wrote:

Hi,

i have several data in a sheet with data in 10 columns...

in column A there are cells where it is blank and i want to delete the rows
where there is blank cell in column A..
I need the vba macro for this

regards,
radha



Ron de Bruin

Macro for Deleting rows with balnk cell
 
For the OP

I suggest to use more code then the macro recorder create
See my reply

And see why here
http://www.rondebruin.nl/specialcells.htm



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm




All times are GMT +1. The time now is 10:20 AM.

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