Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Programming
Problem with deleting blank rows or last row
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Rick Rothstein, post: 6455995"] What is the best way to avoid iterating through You should always ask for what you actually want (do not try to simplify your questions for us, that will only get you working solution for a question you do not actually care about). The following code will create a range of rows, and set it to the DataRows range variable, where each row in DataRows will contain at least one piece of data (note, that is data, constants, NOT formulas) somewhere along the row... Dim LastRow As Long, Lastcolumn As Long, DataRows As Range LastRow = Cells.Find(What:="*", SearchOrder:=xlRows, SearchDirection:=xlPrevious, LookIn:=xlValues).Row Lastcolumn = Cells.Find(What:="*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious, LookIn:=xlFormulas).Column Intersect(Cells.SpecialCells(xlCellTypeConstants).EntireRow, Columns(Lastcolumn + 1)).Value = "X" Set DataRows = Columns(Lastcolumn + 1).SpecialCells(xlCellTypeConstants).EntireRow Columns(Lastcolumn + 1).Delete If you need to locate both data and/or formulas, let me know and I'll modify the coded for you. Rick Rothstein (MVP - Excel) [/QUOTE]
Verification
Post reply
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Programming
Problem with deleting blank rows or last row
Top