Working on a VERY simple function here, I would like to find the bug instead of a new way to do it (I would assume I'm pretty close b/c it's so easy), but I know people are busy, so I'll take whatever you brilliant people are willing to give
I'm creating a function to find the last row (to use in another sub). This Code WORKS:
[vba]Sub Last_Row()
lastRow = Cells(Rows.Count, 1).End(xlUp).Address
End Sub[/vba]
So I would assum my function would work too, but it doesn't:
[vba]
Function LROW(rng) As Range
LROW = Range(rng).Cells(Rows.Count, 1).End(xlUp).Address
End Function
[/vba]
I get the generic error "Object variable or With block variable not set" when I run it through my tester Sub:
[vba]Sub TestLROW()
Dim Test As Range
Test = LROW("A1")
End Sub[/vba]
I've tried the function another way too that more closely mirrors my original working Sub:
[vba]Function LROW(col) As Range
LROW = Cells(Rows.Count, col).End(xlUp).Address
End Function[/vba]
This one gets the same error message..... UGH!
Thank you in advance, you people are great!