Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
how can i find the number of the last line of a sheet??
urgent, please! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
By last line, do you mean the last line that contains data? Press Ctrl+End.
"italo" wrote in message ... how can i find the number of the last line of a sheet?? urgent, please! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This will give you the row number of the last row in column A.
msgbox cells(rows.count, "A").end(xlup).row -- HTH... Jim Thomlinson "italo" wrote: how can i find the number of the last line of a sheet?? urgent, please! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi italo,
You could try: ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) .Row or use the following function: 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 To use the above function: LastCell(Worksheets("Your Worksheet Name")).row or LastCell(ActiveSheet).row Hope this helps, Chris "italo" wrote in message ... how can i find the number of the last line of a sheet?? urgent, please! |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here you go...
iLastRow = UBound(ActiveSheet.UsedRange.Value2, 1) + ActiveSheet.UsedRange.Row - 1 iLastColumn = UBound(ActiveSheet.UsedRange.Value2, 2) + ActiveSheet.UsedRange.Column - 1 -Kent italo wrote: how can i find the number of the last line of a sheet?? urgent, please! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
find next line for data entry | Excel Worksheet Functions | |||
Find and Replace where there are line breaks | Excel Discussion (Misc queries) | |||
How do I find a value on a line? | Charts and Charting in Excel | |||
find out line count source in vbe | Excel Programming | |||
Macro to find the next free line | Excel Programming |