I have an Excel 200 spreadsheet with a lot of labels on them. I want to create an array of these labels so I can do easy loops on all of them.
If I do the following:
dim lblArr() as variant
lblArr(0) = sheet1.label1
then lblArr is set to the data in label1.caption. If I set it as label and not variant then the statement does not work at all.
In VB6 I could use a labelarray or the index.. not so in vba.
NM

Creating an Array of Labels
Slawek Dobrzanski
superb.. thanks alot... go that working
NM
BrunoAMSilva
You can use the Collection type to do this.
Dim MyLabels As New Collection, vEachLabel As Variant
With MyLabels
.Add lbl1
.Add lbl2
<...>
.Add lbl99
End With
For Each vEachLabel In MyLabels
vEachLabel.Caption = "AAAAAAAA"
Next vEachLabel