tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,924
- Office Version
- 365
- 2019
- Platform
- Windows
I have a function as follows:
I can use it in Excel by typing:
which returns the value of 6, as expected.
I have another function which finds the last row on a worksheet:
I tried typing:
but it returned #VALUE !
What is wrong?
Thanks
Code:
Public Function abc (a, b, c)
abc= a + b + c
End Function
I can use it in Excel by typing:
Code:
=abc(1, 2, 3)
which returns the value of 6, as expected.
I have another function which finds the last row on a worksheet:
Code:
Public Function LRow(ByRef wks As Worksheet) As Long
On Error GoTo Correction
With wks
LRow = .Cells.Find(What:="*", _
After:=.Cells(Rows.Count, Columns.Count), _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows).Row
End With
GoTo Exitpoint
Correction:
LRow = 1
Exitpoint:
On Error GoTo 0
End Function
I tried typing:
Code:
= LRow(Sheet1)
but it returned #VALUE !
What is wrong?
Thanks
Last edited: