Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there a simple way to find the last row and column of
an Excel sheet? I am using VB6 to read data from Excel and need to know if there is a property or method that will provide this info. Thanks in advance, WayneM |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Wayne
With this two functions you can do this Sub test() MsgBox LastRow(ActiveSheet) End Sub Function LastRow(sh As Worksheet) On Error Resume Next LastRow = sh.Cells.Find(What:="*", _ After:=sh.Range("A1"), _ Lookat:=xlPart, _ LookIn:=xlFormulas, _ SearchOrder:=xlByRows, _ SearchDirection:=xlPrevious, _ MatchCase:=False).Row On Error GoTo 0 End Function And this one Function Lastcol(sh As Worksheet) On Error Resume Next Lastcol = sh.Cells.Find(What:="*", _ After:=sh.Range("A1"), _ Lookat:=xlPart, _ LookIn:=xlFormulas, _ SearchOrder:=xlByColumns, _ SearchDirection:=xlPrevious, _ MatchCase:=False).Column On Error GoTo 0 End Function -- Regards Ron de Bruin http://www.rondebruin.nl "WayneM" wrote in message ... Is there a simple way to find the last row and column of an Excel sheet? I am using VB6 to read data from Excel and need to know if there is a property or method that will provide this info. Thanks in advance, WayneM |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
FInd common data in one column then add number in adjacent column | Excel Worksheet Functions | |||
find last row value in column when using MATCH to find column | Excel Worksheet Functions | |||
Find something in column a then find if column B matches criteria | Excel Discussion (Misc queries) | |||
Find First Non blank cell than find column header and return that value | Excel Worksheet Functions | |||
To find Multiple values in column B for a unique value in column A | Excel Worksheet Functions |