Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default how to delete empty row in vba

I have one excel spreed sheet, I need to delete all the
empty row, also some of cell in columnF if is the space,
then this record need to delete as well.
Anyone know how to write the vba macro?

thanks.

Lillian
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default how to delete empty row in vba

Hi

Please stay in your other thread

Run the TRIMALL macro I posted in that thread
And run this macro if you want to delete each row if the whole row is empty.


Sub DeleteEmptyRows()
'Dave Braden
Dim l As Long, rng As Range, rngDel As Range

On Error Resume Next
Set rng = ActiveSheet.UsedRange
With rng.Columns
Set rngDel = .Item(1).SpecialCells(xlCellTypeBlanks).EntireRow

For l = 2 To .Count
Set rngDel = Intersect(rngDel, _
.Item(l).SpecialCells(xlCellTypeBlanks).EntireRow)
If rngDel Is Nothing Then Exit Sub
Next
End With
Application.ScreenUpdating = False
rngDel.Delete
End Sub




--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Lillian" wrote in message ...
I have one excel spreed sheet, I need to delete all the
empty row, also some of cell in columnF if is the space,
then this record need to delete as well.
Anyone know how to write the vba macro?

thanks.

Lillian



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default how to delete empty row in vba

Hi,

I did not konw how to run that TRIMALL macro, as I said
in the previous mail, I need to you told me too, still
not working, but I use the below script, all the empty
row is gone, that what I like it, thanks.

Now I need to delete the record when each rows of
columnF is space (" "), how to do that?


-----Original Message-----
Hi

Please stay in your other thread

Run the TRIMALL macro I posted in that thread
And run this macro if you want to delete each row if the

whole row is empty.


Sub DeleteEmptyRows()
'Dave Braden
Dim l As Long, rng As Range, rngDel As Range

On Error Resume Next
Set rng = ActiveSheet.UsedRange
With rng.Columns
Set rngDel = .Item(1).SpecialCells

(xlCellTypeBlanks).EntireRow

For l = 2 To .Count
Set rngDel = Intersect(rngDel, _
.Item(l).SpecialCells

(xlCellTypeBlanks).EntireRow)
If rngDel Is Nothing Then Exit Sub
Next
End With
Application.ScreenUpdating = False
rngDel.Delete
End Sub




--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Lillian" wrote in message

...
I have one excel spreed sheet, I need to delete all the
empty row, also some of cell in columnF if is the

space,
then this record need to delete as well.
Anyone know how to write the vba macro?

thanks.

Lillian



.

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
delete row if 2 cells are empty Wanna Learn Excel Discussion (Misc queries) 1 November 19th 09 10:20 PM
If cell empty delete row Clive[_2_] Excel Discussion (Misc queries) 1 November 8th 09 12:51 AM
Delete Row If Empty Macro Richard Excel Discussion (Misc queries) 3 January 20th 06 11:26 PM
Delete rows if they are empty chrismania[_7_] Excel Programming 4 October 27th 03 12:32 AM
Delete rows if they are empty chrismania[_3_] Excel Programming 2 October 18th 03 04:27 PM


All times are GMT +1. The time now is 04:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"