BKrukowski
Board Regular
- Joined
- May 6, 2009
- Messages
- 88
I as receiving a run time 28 error when I use a loop to fill a collection of class objects. The error occurs on line .Profit = ActiveCell.Offset(0, 3).value.
I have tried many references about this and they do not seem to apply to my code (I am not calling excessive Subs, I do not believe I have a recursive trigger (unless Setting class objects is a recursive trigger). When I look at the Stack only two things appear - the Sub I am running and something called [<non-basic Code="">]
Prior to the code below I a
assign variable to take the UserForm Controls values
Resize and Fill cells (with Selection.Interior)
Go to a different Sheet - this is a table of data that are attributes to the class object cReslEstate
</non-basic>
I have tried many references about this and they do not seem to apply to my code (I am not calling excessive Subs, I do not believe I have a recursive trigger (unless Setting class objects is a recursive trigger). When I look at the Stack only two things appear - the Sub I am running and something called [<non-basic Code="">]
Prior to the code below I a
assign variable to take the UserForm Controls values
Resize and Fill cells (with Selection.Interior)
Go to a different Sheet - this is a table of data that are attributes to the class object cReslEstate
Code:
Set GameRealEstate = New Collection
'Populate Real Estate randomly
i = 1
For i = 1 To PropCount
Set ReProp = New cRealEstate
ActiveCell.Offset(Int(100 - 1 + 1) * Rnd + 1).Activate
With ReProp
.Name = ActiveCell.value
.Cost = ActiveCell.Offset(0, 1).value
.Rent = ActiveCell.Offset(0, 2).value
.Profit = ActiveCell.Offset(0, 3).value
.Mort = ActiveCell.Offset(0, 4).value
End With
Range("A:A").Find(GLoc).Activate
ActiveCell.Offset(0, 1).Activate
Next I