Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
DELETING LINES THAT ARE THE SAME IN A TABLE | Excel Discussion (Misc queries) | |||
Deleting unused lines between used lines? | Setting up and Configuration of Excel | |||
Deleting Lines in Excel | Excel Discussion (Misc queries) | |||
Deleting lines really deletes lines! | Excel Programming | |||
Deleting duplicate lines | Excel Programming |