Thread: Last row used
View Single Post
 
Old 04-04-2019, 08:52 PM
abenitez77 abenitez77 is offline Windows 10 Office 2016
Novice
 
Join Date: Apr 2019
Posts: 9
abenitez77 is on a distinguished road
Question Last row used

Hello,
I am using this line to get the last row and column used:

Code:
Set lastRow = ws.Cells.SpecialCells(xlCellTypeLastCell).EntireRow
Set lastColumn = ws.Cells.SpecialCells(xlCellTypeLastCell).EntireColumn
It is working but I have a sheet where the last row is row 18488. The problem is that between that row and the next row up is row 98. Everything in between is empty. The last row (18488) has a text "Please do not enter data beyond this row. The price entry limit is 20,000 rows." I want my last row to be row 98. How do I exclude the text in row 18488?

I am getting the last row so that I can use it as a range and then save it to an array so I can loop thru:
Code:
Set lastRow = ws.Cells.SpecialCells(xlCellTypeLastCell).EntireRow
Set lastColumn = ws.Cells.SpecialCells(xlCellTypeLastCell).EntireColumn

Set rRange = Range(Cells(1, 1), Cells(LastRow, LastCol))

      ' Copy the Range to an Array
      myarray2 = rRange
            
      For r = 3 To UBound(myarray2)

Last edited by abenitez77; 04-05-2019 at 04:38 AM.
Reply With Quote