Excel VBA: inserting WHEN formula into specific range of cells with variable changing column -
hello dear stackoverflow users,
my issue regarding inserting formular via macro specific range of cells. again, again , again.
so basic function of formula should following:
=when('zek '!f3="x";"6";when('zek '!g3="x";"8";"1"))
in macro has change column next specific range. happening in loop i
growing.
meaning --> =when('zek '!$f$"& i+2 &".......
or in other syntax should work. try not, thats why need help.
this initial try exchanged literally strings:
sub 123() dim a,b,c string = 1 b = 6 c = 8 .... 'used , declared variables k, x, f, a, b, c range(cells(k + 2, 5), cells(k + 27, 5)).formular1c1 = _ "=when('zek'!$f$" & f & "=" & x & ";" & & ";when('zek'!$g$" & f & "=" & x & ";" & b & ";" & c & "))" end sub
with runtime error 1004. (changed .formula .formular1c1)
i hope gave enough information, me. not have performant, need formula 100.000 cells i
changing each range of cells
i think it's language problem... try
"=if('zek'!$f$" & f & "=" & x & "," & & ",if('zek'!$g$" & f & "=" & x & "," & b & "," & c & "))"
notice use of if
, ,
delimiter instead of ;
. when
valid worksheet function? honest don't know if worksheet functions translated or not when setting formula via vba. delimiters adapted though.
edit: there .formulalocal
property should work ;
delimiter! change .formula
.formulalocal
. cause error if execute on machine uses ,
default delimiter i'd try stick .formula
.
Comments
Post a Comment