ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filling an array with integer variable (https://www.excelbanter.com/excel-programming/298180-filling-array-integer-variable.html)

Erche DP

Filling an array with integer variable
 


Hello,
I have this small scripts, and is not working since an error occured :
Expected Array!
Therefore, i am wondering, can we fill an array with an integer variable
?

private sub test ()
dim arrtemp as variant, x as integer

for i=0 to 10
arrtemp(i)=x+i 'Error!
next

end sub

Could you suggest, what to fix ?

Thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Bob Phillips[_6_]

Filling an array with integer variable
 
I got a Type Mismatch error, but this worked

Dim arrtemp(0 To 10), x As Integer, i

For i = 0 To 10
arrtemp(i) = x + i 'Error!
Next


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Erche DP" wrote in message
...


Hello,
I have this small scripts, and is not working since an error occured :
Expected Array!
Therefore, i am wondering, can we fill an array with an integer variable
?

private sub test ()
dim arrtemp as variant, x as integer

for i=0 to 10
arrtemp(i)=x+i 'Error!
next

end sub

Could you suggest, what to fix ?

Thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!





All times are GMT +1. The time now is 04:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com