|
-
Apr 5th, 2004, 03:05 PM
#1
Thread Starter
New Member
Insert excel formulas from VB array..
I have been trying to get an array full of formulas to insert into a range on excel spreadsheat; however the formulas end up showing as text and not evaluating. I have tried sever different commands and none seem to work. I currently am outputing one cell's formula at a time but this is painfully slow and i was hoping to improve speed by storing them in an array and puting out the whole array of formulas at one time. Is this possible? and if it is how can it be done. range.formula = array does not seem to work.
-
Apr 5th, 2004, 04:23 PM
#2
Lively Member
This worked for me:
VB Code:
Sub usearray()
Xarray = Worksheets(1).Range("C3", "K26").Formula
Worksheets(1).Range("C103", "K126") = Xarray
End Sub
Don't forget to dim the array as a variant.
(well actually, I guess if you do forget, it will do it for you anyway... but the point was don't dim as as something other than variant for this to work.)
Last edited by TheFIDDLER; Apr 5th, 2004 at 04:40 PM.
-----
#VBA, VB 6 Professional Edition, Office XP Developper. Excel 97, Excel 2000, Excel XP
I miss my VIC 20.
Never should have upgraded to my commodore 64. ...
-
Apr 5th, 2004, 07:17 PM
#3
Lively Member
Also your destination range must be the same size as your array.
-----
#VBA, VB 6 Professional Edition, Office XP Developper. Excel 97, Excel 2000, Excel XP
I miss my VIC 20.
Never should have upgraded to my commodore 64. ...
-
Apr 6th, 2004, 07:10 AM
#4
Thread Starter
New Member
Thank You So much the only problem with my code was that i had the array declared as strings. When I changed it it worked. Never would have thought that would affect anything.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|