ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Formulas assignment from array to range in VSTO Excel doesn't work (https://www.excelbanter.com/excel-worksheet-functions/169289-formulas-assignment-array-range-vsto-excel-doesnt-work.html)

vsto excel array to range

Formulas assignment from array to range in VSTO Excel doesn't work
 
Hi there...

Please, I'd appreciate any help...

I'm trying to put pregenerated formulas in a Cell Range "R" in VSTO Excel.
Formulas are inside array named "formulas". When I run CODE 1, working step
by step, cell by cell, it goes OK but in a kind of "slow motion". Therefore
I'm trying CODE 2, looking for direct formula assignment. But, when I run my
CODE 2 program, no formula is assigned to the cells in range, and there isn“t
any error message. The index are all in valid ranges, and there are same
number of cells, both in the array and in the Cell Range.

Please, give me some advice, showing me what am I doing wrong here.

I've really no idea.

Thank you very much in advance !
Max


CODE SAMPLES :


CODE 1:

Dim Ri As Integer = 11
Dim Rf As Integer = i - 1

For Ri = 11 To Rf
Globals.Hoja10.Range(Columna & Ri).Select()
Globals.Hoja10.Range(Columna & Ri).Value2 = Formulas(Ri - 11)
Next


CODE 2:

Dim Formulas(LastReg - 11) As Object
Dim R As Excel.Range
R = Globals.Hoja10.Range(Columna & "11:" & Columna & i - 1)
R.Value2 = Formulas

CODE 3:
Sample formula in array

"=SUMIF(BD!C1:C3000,A12,BD!E1:E3000)"




All times are GMT +1. The time now is 01:26 AM.

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