ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Defining a Range (https://www.excelbanter.com/excel-programming/309072-defining-range.html)

Kaval

Defining a Range
 
I want to define the last used row on a worksheet. I could use
"SpecialCells(xlLastCell)" however this also includes extra rows that were
used previously but are now empty.

I think there is a function that gives the last cell or row in a block/table
of cells but I can't find it.

Any ideas?

Kaval



Don Guillett[_4_]

Defining a Range
 
I used Ron DeBruin's google search addin
http://tinyurl.com/4d2yg

--
Don Guillett
SalesAid Software

"Kaval" wrote in message
...
I want to define the last used row on a worksheet. I could use
"SpecialCells(xlLastCell)" however this also includes extra rows that were
used previously but are now empty.

I think there is a function that gives the last cell or row in a

block/table
of cells but I can't find it.

Any ideas?

Kaval





Gord Dibben

Defining a Range
 
Kaval

Sub FindLastRow()
Dim LastRow As Long
If WorksheetFunction.CountA(Cells) 0 Then
'Search for any entry, by searching backwards by Rows.
LastRow = Cells.Find(What:="*", after:=[A1], _
SearchOrder:=xlByRows, _
searchdirection:=xlPrevious).Row
MsgBox LastRow
End If
End Sub

Gord Dibben Excel MVP

On Sun, 5 Sep 2004 15:13:02 -0700, "Kaval"
wrote:

I want to define the last used row on a worksheet. I could use
"SpecialCells(xlLastCell)" however this also includes extra rows that were
used previously but are now empty.

I think there is a function that gives the last cell or row in a block/table
of cells but I can't find it.

Any ideas?

Kaval





All times are GMT +1. The time now is 10:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com