ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find last used cell in an column (https://www.excelbanter.com/excel-programming/273548-find-last-used-cell-column.html)

Niklas[_3_]

Find last used cell in an column
 
Hi
What is the best way of finding the last used cell in a
column?
At the moment i use:

While Len(i_workSheet.Range(i_sColumn & CStr
(i_iIndex)).value) 0
i_iIndex = i_iIndex + 1
Wend

GetLastUsedRowInColumn = i_iIndex

Yours sincerly
/Niklas

William[_2_]

Find last used cell in an column
 
Hi

MsgBox Range("A" & Rows.Count).End(xlUp).Address

or

Range("A" & Rows.Count).End(xlUp).select

--
XL2002
Regards

William


"Niklas" wrote in message
...
| Hi
| What is the best way of finding the last used cell in a
| column?
| At the moment i use:
|
| While Len(i_workSheet.Range(i_sColumn & CStr
| (i_iIndex)).value) 0
| i_iIndex = i_iIndex + 1
| Wend
|
| GetLastUsedRowInColumn = i_iIndex
|
| Yours sincerly
| /Niklas




All times are GMT +1. The time now is 10:00 PM.

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