Hi,

I'm trying to code a class at the moment and I want to set a range as one of it's properties. Is this going to be possible? I've included a snippet of the code that I can't get to work. Can anyone point out what I am missing?

The class module code, titled Class1:

[vba]
Option Explicit
Dim rg As Range

Public Property Get StartCell() As Range
StartCell = rg
End Property
Public Property Let StartCell(Value As Range)
rg = Value
End Property
[/vba]

The test code:

[vba]
Option Explicit

Sub ClassTest()

Dim Class1 As Class1
Dim rg As Range

Set Class1 = New Class1
Set rg = ThisWorkbook.Worksheets(1).Range("A1")
Class1.StartCell = rg

End Sub
[/vba]

When I run this I get the following error: "Run Time Error 91: Object Variable or With block variable not set".

Any ideas?