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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete all rows above 1st row containing text 1

Status
Not open for further replies.

jdttek

Technical User
May 8, 2002
112
US
I am trying to automatically clean up formatting on a downloaded spreadsheet. Sometimes there are 3-4 blank lines before the 1st row of data. I need to automatically select and delete those rows so that Data starts on Row 1. Any sugested code pls? Number of blank rows varies, so it needs to by dynamic to find actual 1st non-blank row, select rows above and delete them. Thanks

JDTTEK
 
Hi jdttek
this should do the trick:

Sub CleanRows()
With Activesheet
fRow = .range("A1").end(xldown).row
.rows("1:" & fRow-1).entirerow.delete
end with
end sub Rgds
~Geoff~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top