I have a long list in an Excel spreadsheet, and for each cell I would like to create a new object, but I cannot figure out how to do this.
I have something like:
Dim k As Integer
k = 0
Do
If ActiveCell.Offset(k, 0).Value = "" Then Exit Do
Dim Player&k As New CPlayer
'Attempting to create a new object with name Player0, Player1, ...
Set Player&k.Name = ActiveCell.Offset(k, 0).Value
k = k + 1
Loop
As you probably can say, I know little about VBA or object-oriented programming, I have only one task that I am trying to accomplish. The above code leads to a compilation error, so obviously this is not the right way to do this, is there an easy way to do what I'm trying or not really?
source
share