Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
------------------------------------------------------------------------------------------

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Create my own Class Object for Ranges, having trouble assigning name property

I figured it out but now I'm unclear as to why I created my own class
for this. I wanted all the info to be organized.

The statement I needed to generate was:

Worksheets("Calc-Codes").Range("AB7:AB" & Trim(Str(iRow_Unique))).Name
= "Market Report Programs"

Can anyone explain to me how I can keep my info organized in a
colletion of objects?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Create my own Class Object for Ranges, having trouble assigning name property

The name property of what? What exactly are you trying to set here?

--

HTH

RP
(remove nothere from the email address if mailing direct)


wrote in message
oups.com...
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
--------------------------------------------------------------------------

----------------



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Create my own Class Object for Ranges, having trouble assigning name property

NAME PROPERTY OF BUILT IN RANGE CLASS.

I created a custom class of objects that would juggle a huge amount of
ranges. If you look at the custom class I created it defines a property
of type Range.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Create my own Class Object for Ranges, having trouble assigning name property

Seems like it would be easier to just use a collection. However:

http://tinyurl.com/begok

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
NAME PROPERTY OF BUILT IN RANGE CLASS.

I created a custom class of objects that would juggle a huge amount of
ranges. If you look at the custom class I created it defines a property
of type Range.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
assigning class standing based on grade Christopher Excel Discussion (Misc queries) 3 November 12th 06 09:06 PM
How to cycle through each of property and its value of Class? Tetsuya Oguma Excel Worksheet Functions 1 March 3rd 06 10:36 AM
Cannot set HorizontalAlignment Property of the Range Class Alan Excel Programming 10 December 10th 04 12:57 AM
Access to class property in other workbook BenD[_2_] Excel Programming 2 March 3rd 04 09:11 AM
Using Property Let with a Type as member of a Class Ken Dahlberg Excel Programming 5 December 21st 03 05:57 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"