Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi there,
I am using the following code that I have been told is fairl infallable at finding the last populated row of my data table. Th routine Last_Row then displays the last row number. What I can' manage to figure out how to do is actually select column A of the Las row - sure it is simple but I am missing it. Thanks Andi Function LastCell(ws As Worksheet) As Range Dim LastRow&, LastCol% ' Error-handling is here in case there is not any ' data in the worksheet On Error Resume Next With ws ' Find the last real row LastRow& = .Cells.Find(What:="*", _ SearchDirection:=xlPrevious, _ SearchOrder:=xlByRows).Row ' Find the last real column LastCol% = .Cells.Find(What:="*", _ SearchDirection:=xlPrevious, _ SearchOrder:=xlByColumns).Column End With ' Finally, initialize a Range object variable for ' the last populated row. Set LastCell = ws.Cells(LastRow&, LastCol%) End Function ---------------------------------------------- Sub Show_Last_Row() MsgBox LastCell(Sheet2).Cell End Su -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Extract number from cell when specific format is found | Excel Worksheet Functions | |||
Count the number of Commas found in cell A2 | Excel Worksheet Functions | |||
How to select the number in excel? | Excel Worksheet Functions | |||
Advanced Filter: Number of Records Found | Excel Discussion (Misc queries) | |||
is there someway to select what i have "found"? | New Users to Excel |