mvidas
12-08-2004, 12:12 PM
Hi Everyone,
I'm looking for information or links on how I could create my own method. I'm not referring to a UDF, but an actual method (or property I suppose). As a very simple example, I could write the following in excel vba:
Sub testSub()
Dim RG As Range, LRow As Long
Set RG = Range("B2:D25")
LRow = TheLastRow(RG)
Msgbox LRow
End Sub
Public Function TheLastRow(Rng As Range) As Long
TheLastRow = Rng.Row + Rng.Rows.Count - 1
End Function
But I was wondering how I could create a .LastRow method, so I could use:
LRow = RG.LastRow
Note that I'm not really after a .LastRow method, but merely just using that as a very simple example. I'm assuming I'll need a normal VB program for this rather than VBA, and I wouldn't mind that as I'd like to pick up a copy anyways. Any help, or pointing me in the right direction, would be greatly appreciated!
Thanks
Matt
I'm looking for information or links on how I could create my own method. I'm not referring to a UDF, but an actual method (or property I suppose). As a very simple example, I could write the following in excel vba:
Sub testSub()
Dim RG As Range, LRow As Long
Set RG = Range("B2:D25")
LRow = TheLastRow(RG)
Msgbox LRow
End Sub
Public Function TheLastRow(Rng As Range) As Long
TheLastRow = Rng.Row + Rng.Rows.Count - 1
End Function
But I was wondering how I could create a .LastRow method, so I could use:
LRow = RG.LastRow
Note that I'm not really after a .LastRow method, but merely just using that as a very simple example. I'm assuming I'll need a normal VB program for this rather than VBA, and I wouldn't mind that as I'd like to pick up a copy anyways. Any help, or pointing me in the right direction, would be greatly appreciated!
Thanks
Matt