Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XL VBA Identify Empty Rows in Range 1

Status
Not open for further replies.

lameid

Programmer
Jan 31, 2001
4,212
US
I have a workbook with a series os sheets each with one or multiple table like structures (they look like paste special values of Pivot Tables with the total lines blanked out).

Because I have to fill key fields down and add my own identifiers I am looking for an easy way to delete the empty rows programmatically (when I fill down with a macro it will fill in empty rows so sorting doesn't work out)
 
Thanks... I had a problem with the delete blank rows functions.

My changes below...

Code:
'Set Rng = WS.Cells.Find(what:="*", after:=WS.Cells(WS.Rows.Count, WS.Columns.Count), lookat:=xlPart, _
    searchorder:=xlByColumns, searchdirection:=xlPrevious, MatchCase:=False)
    Set Rng = Range(Range("A1"), Range("A1").SpecialCells(xlLastCell))
'LastRow = Rng.Row
LastRow = Rng.Rows.Count

['Code]

The find was always returning 1 for Rng.Row which means it didnt't process the entire sheet.
 
Oops got the TGML wrong... And comments should be green too [smile]


Code:
[green]'Set Rng = WS.Cells.Find(what:="*", after:=WS.Cells(WS.Rows.Count, WS.Columns.Count), lookat:=xlPart, _ 
   searchorder:=xlByColumns, searchdirection:=xlPrevious, MatchCase:=False)[/green]


Set Rng = Range(Range("A1"), Range("A1").SpecialCells(xlLastCell))

[green]'LastRow = Rng.Row[/green]

LastRow = Rng.Rows.Count
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top