newbie to ClModules is this correct use of Property Set?.....

W

WhytheQ

I'm just after some advice as to whether I'm heading in the correct
direction.
I'm new to class modules so just wondering if the below looks logical
+ efficient.
Any advice greatly appreciated
JasonQ.



'this is in a Class Module "myClass":
'=================================
Private R As Range
Private TR As Integer


Public Property Set TopLeftCell(ByRef sVal As Range)
Set R = sVal
TR = R.Row
End Property
Public Property Get TopLeftCell() As Range
Set TopLeftCell = R
End Property


Public Property Get TopRow() As Integer
TopRow = TR
End Property




'This is in a normal module:
'=================================
Dim X As myClass

Sub test()

Set X = New myClass
Set X.TopLeftCell = ActiveSheet.Range("AD4")

MsgBox X.TopRow

Set X = Nothing

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top