View Full Version : Why doesn't the xlcelltypelastcell not giving the last cell inside a list?
prabhafriend
07-07-2011, 03:05 AM
Why doesn't the xlcelltypelastcell not giving the last cell inside a list if all other enumerations working perfectly inside a list like visiblecells and all. What is the shortest way (best way) to locate the last cell inside a list.
Kenneth Hobs
07-07-2011, 07:58 AM
What code are you using? When you say list, do you mean a list 2003 which is a table in 2007+ or do you mean a range? When you say last cell, do you mean last cell with data or last cell in the "list".
Using the SpecialCells method:
MsgBox Range("Table1").SpecialCells(xlCellTypeLastCell).Address
This finds the last cell empty or not in a range or a "Table".
With Range("Table1")
MsgBox .Areas(.Areas.Count).Cells(.Areas(.Areas.Count).Rows.Count, 1).Address
End With
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.