Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting lines with no data

I'm a newbie in excel and i want to now how can i delete a
full line in excel that have no data on it, From line 1 to
400 (Supose) i'm trying to make a code that choose all the
lines that have no data and automatic select and delete
them.

Help should be apreciated....Thank you!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Deleting lines with no data

Something like (untested):

Sub DeleteBlankRows()
Dim i As Long, rng As Range
For i = 1 To 400
If WorksheetFunction.CountA(Rows(i)) = 0 Then
If rng Is Nothing then
Set rng = Rows(i)
Else
Set rng = Union(rng, Rows(i))
End If
End If
Next
rng.Delete
End Sub

--

Vasant


"Paulo Gonçalves" wrote in message
...
I'm a newbie in excel and i want to now how can i delete a
full line in excel that have no data on it, From line 1 to
400 (Supose) i'm trying to make a code that choose all the
lines that have no data and automatic select and delete
them.

Help should be apreciated....Thank you!!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default Deleting lines with no data

Vasant's approach will work perfectly well for 99% of cases in a simple
book. If you are looking for a more complex solution there's a routine in my
XspandXL add-in on the site below that does this for rows and or columns
while also checking for charts and other shapes, and dealing with any hidden
rows or outlining in the sheet.

Robin Hammond
www.enhanceddatasystems.com


"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Something like (untested):

Sub DeleteBlankRows()
Dim i As Long, rng As Range
For i = 1 To 400
If WorksheetFunction.CountA(Rows(i)) = 0 Then
If rng Is Nothing then
Set rng = Rows(i)
Else
Set rng = Union(rng, Rows(i))
End If
End If
Next
rng.Delete
End Sub

--

Vasant


"Paulo Gonçalves" wrote in message
...
I'm a newbie in excel and i want to now how can i delete a
full line in excel that have no data on it, From line 1 to
400 (Supose) i'm trying to make a code that choose all the
lines that have no data and automatic select and delete
them.

Help should be apreciated....Thank you!!





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
DELETING LINES THAT ARE THE SAME IN A TABLE conditional format if cell contains word[_2_] Excel Discussion (Misc queries) 1 May 28th 09 03:04 AM
Deleting unused lines between used lines? Stevel Setting up and Configuration of Excel 1 November 25th 05 12:58 AM
Deleting Lines in Excel sibadee14 Excel Discussion (Misc queries) 1 November 16th 05 06:56 AM
Deleting lines really deletes lines! Jim[_28_] Excel Programming 1 October 2nd 03 03:32 PM
Deleting duplicate lines Tom Ogilvy Excel Programming 0 September 18th 03 04:27 PM


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