Hi gagsd,
it is not what I had in mind.
This solution means looping and that I wanted to avoid.
I was looking for a more simple way.
Similar to erasing the array...
Kr Eric
Main Topics
Browse All TopicsDear experts,
In Excel VBA I define dim ObjAss(100000) as variant.
Now I would like to assign 3240 to each cell of this array as its default intitial value.
Is this possible with looping thru and filling each cell separately?
Kr Eric
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Eric,
I'm glad that worked out. I was curious about performance, so I wrote the sub below to test my approach
vs simply looping through the array to populate it.
As I suspected, my approach was much, *MUCH* slower. The looping approach is consistently coming
in at under 1 second to do 100 of these, and the Split approach at 26 seconds to do 100 of them.
And cheers to Rory for a showing us a *very* original approach to doing this!
Patrick
Hi Patrick,
you are right it is slower.
But if you leave out the loop the TestStr = String(100001, "x") and TestStr = Mid(Replace(TestStr, "x", ":3240"), 2) it cuts back to 11 seconds.
Even this is much slower.
Need to do it once from time to time in my macro so speed is not really the problem here.
I wanted to have a neat and slim code to reset the Usingvariant to original numbers.
And the usingvariant = split (Teststr, ":") is giving me just that.
Thanks for pointing out the speed difference though..
Kind regards
Eric
Business Accounts
Answer for Membership
by: gagsdPosted on 2009-10-08 at 01:43:35ID: 25523184
Hope this helps :0-)
Sub Fill()
Dim ObjAss(100000) As Variant
N = 10
For I = 1 To N
ObjAss(I) = 3240
Next I
For J = 1 To N
Range("A" & J).Value = ObjAss(J)
Next J
End Sub