nagovind
Member
Dear All
Need the VBA code with arrays in the below manner.
10 different numbers has to be stored in an array
This data is already available in a sheet name "Sheet1" in the range A1 to A10
Please advise how to assign these 10 numbers stored in a 10 different cells in "Sheet1" into an array named pnum
Further please advise how to use the data in the stored number in the array in the loop
Please advise
Regards
Govind
Need the VBA code with arrays in the below manner.
Code:
Dim pnum(0 To 10000) As Variant
pnum(1) = 2
pnum(2) = 64
pnum(3) = 126
pnum(4) = 188
pnum(5) = 250
pnum(6) = 312
pnum(7) = 374
pnum(8) = 436
pnum(9) = 498
pnum(10) = 560
This data is already available in a sheet name "Sheet1" in the range A1 to A10
Please advise how to assign these 10 numbers stored in a 10 different cells in "Sheet1" into an array named pnum
Further please advise how to use the data in the stored number in the array in the loop
Code:
For i = 0 to 1000
if pnum(i) = i then
k = k+1
Endif
Next i
Please advise
Regards
Govind
Last edited by a moderator: