I have a function to find the last row of a sheet, I want to use this to find the last row of each sheet that are setup in an array.
I am getting a ByRef error argument type mismatch.
It seems correct to me....
LastRow Line:
[VBA]
For ai = LBound(wsArray) To UBound(wsArray)
Set wsArray = Worksheets(wsArray(ai))
With wsArray
lrwSource = lr(wsArray(ai), 1)
[/VBA]
Function:
[VBA]
Function lr(ws As Worksheet, Col As Variant) As Long
Application.Volatile
If Not IsNumeric(Col) Then Col = Columns(Col).Column()
lr = ws.Cells(Rows.Count, Col).End(xlUp).Row
End Function
[/VBA]