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

  • Thread starter vsto excel array to range
  • Start date
V

vsto excel array to range

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)"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top