To get around the limitation that Range.FormulaArray cannot accept a formula more than 255 chars in length, I use this work around:
long_formula_part1 = "=ZZZ(""a"",""b"",""c"",""somekey=tick,tock,jog"",dummy"
long_formula_part2 = ",""e"",""f"",""g"")"
to_replace = ",dummy"
act_formula = "ABC"
Range r = ' some range in excel
With r
.formulaArray = long_formula_part1
.Replace to_replace, long_formula_part_2
'I do the following because I don't want the actual formula to fire until I am done replacing everything
'My actual formula is a User Defined function written in C++
.Replace "ZZZ", act_formula
End With
My problem happens when the regional settings is not English US. If I switch to Germany, it looks like the list separator is a ';' as opposed to ','. So lets say I do this instead:
long_formula_part1 = "=ZZZ(""a"";""b"";""c"";""somekey=tick,tock,jog"";dummy"
long_formula_part2 = ";""e"";""f"";""g"")"
to_replace = ";dummy"
act_formula = "ABC"
Range r = ' some range in excel
With r
.formulaArray = long_formula_part1
'NOTE: The following line promptly fails if the Replace function sees any *semi-colon* in either its
'first parameter or its second
.Replace to_replace, long_formula_part_2
.Replace "ZZZ", act_formula
End With
Is there a way out?
long_formula_part1 = "=ZZZ(""a"",""b"",""c"",""somekey=tick,tock,jog"",dummy"
long_formula_part2 = ",""e"",""f"",""g"")"
to_replace = ",dummy"
act_formula = "ABC"
Range r = ' some range in excel
With r
.formulaArray = long_formula_part1
.Replace to_replace, long_formula_part_2
'I do the following because I don't want the actual formula to fire until I am done replacing everything
'My actual formula is a User Defined function written in C++
.Replace "ZZZ", act_formula
End With
My problem happens when the regional settings is not English US. If I switch to Germany, it looks like the list separator is a ';' as opposed to ','. So lets say I do this instead:
long_formula_part1 = "=ZZZ(""a"";""b"";""c"";""somekey=tick,tock,jog"";dummy"
long_formula_part2 = ";""e"";""f"";""g"")"
to_replace = ";dummy"
act_formula = "ABC"
Range r = ' some range in excel
With r
.formulaArray = long_formula_part1
'NOTE: The following line promptly fails if the Replace function sees any *semi-colon* in either its
'first parameter or its second
.Replace to_replace, long_formula_part_2
.Replace "ZZZ", act_formula
End With
Is there a way out?