Article ID: 108731
Article Last Modified on 10/11/2006
Option Explicit
Private iMyCount As Integer
Private rMyRange As Variant
' Use Property Let for Variants
Property Let MyCount(iCount As Variant)
iMyCount = iCount
End Property
Property Get MyCount()
MyCount = iMyCount
End Property
' Use Property Set for Objects
Property Set MyRange(rRange As Range)
' Use Set because rRange is a Range Object
Set rMyRange = rRange
End Property
Property Get MyRange()
Set MyRange = rMyRange
End Property
Option Explicit
Sub TestCount()
Dim rRange As Range
Set rRange = ActiveSheet.Range("B1")
rRange.Value = 7777
' Execute module SGLCount Property Set MyRange:
Set SGLCount.MyRange = ActiveSheet.Range("B1")
ActiveSheet.Range("A1").Select
' Execute module SGLCount Property Set MyCount:
SGLCount.MyCount = 5
' Execute module SGLCount Property Get MyRange:
rRange = SGLCount.MyRange
' Execute module SGLCount Property Get MyCount:
rRange.Value = SGLCount.MyCount
rRange.Select
End Sub
Keywords: KB108731