ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   newbie to ClModules is this correct use of Property Set?..... (https://www.excelbanter.com/excel-programming/406771-newbie-clmodules-correct-use-property-set.html)

WhytheQ

newbie to ClModules is this correct use of Property Set?.....
 
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


All times are GMT +1. The time now is 12:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com