View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] mimiqinc@aol.com is offline
external usenet poster
 
Posts: 3
Default Create my own Class Object for Ranges, having trouble assigning name property

I created a Class called Market_Report.

I then created several instances of Market_Report in a collection
called grMarket_Report_Ranges

Now I am calling the object and was able to set a range to the object
but cannot assign the name property.

grMarket_Report_Ranges is defined as global collection. g is for
global, r is for range.

So the following works:

---code---
Set grMarket_Report_Ranges.Program(iRP_Array_Dimension ) =
Worksheets("Calc-Codes").Range("AB7:AB" & Trim(Str(iRow_Unique)))
---code---

The following does not with or w/o a Set statement.:

---code---
grMarket_Report_Ranges.Program(iRP_Array_Dimension ).Name = "Market
Report Programs"
---code---

I get a RTE 91, Object variable or with block variable not set

Here is what my class looks like:

'CLASS START -------------------------

Option Explicit

Private mrProgram() As Range

Public Function Initialize(iDimensions As Integer)

ReDim Preserve mrProgram(iDimensions)

End Function

Public Property Get Program(ByVal i As Integer) As Range
Program = mrProgram(i)
End Property

Public Property Set Program(ByVal i As Integer, ByVal r As Range)
Set mrProgram(i) = r
End Property

'CLASS END
------------------------------------------------------------------------------------------