vendredi 27 février 2015

Assigning value to array without loop

I am using the below code to assign values to an array. I'm using For loop for this. Is there any other way which can be used in which I don't have to assign value cell by cell?



ReDim OccGroupELT(ELTRowNum, 14)
For i = 1 To ELTRowNum
'year
OccGroupELT(i, 1) = Sheets("main").Range("C15").Offset(i - 1, 0)
'eventID
OccGroupELT(i, 2) = Sheets("main").Range("C15").Offset(i - 1, 1)
'loss
For j = 3 To 14
OccGroupELT(i, j) = Sheets("main").Range("C15").Offset(i - 1, j - 1).Value * (1 + Factor)
Next j
Next i

Aucun commentaire:

Enregistrer un commentaire