View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Passing Arguments

Sub LastRow()
val = FindLastRow ("A")
ActiveCell.Formula = val
End Sub

Public Function FindLastRow(cell) As String
Dim LastRow
LastRow = Range(cell & Rows.Count).End(xlUp).Row
FindLastRow = LastRow
End Function

--
Regards,
Tom Ogilvy


"Grant Reid" wrote in message
...
Hi

I have a routine that calls a function to determine the last row in a

range.
I need the function to return the last row number to the calling routine
which will place the number in the active cell.

Hope someone can help.

Sub LastRow()
FindLastRow ("A")
ActiveCell.Formula = ???????
End Sub

Public Function FindLastRow(cell) As String
Dim LastRow
LastRow = Range(cell & Rows.Count).End(xlUp).Row
End Function

Many Thanks - Grant