creating a formula string in VBA using part formula and part hard coded string -



creating a formula string in VBA using part formula and part hard coded string -

dim cell_range range set cell_range = worksheets("beans").range("t11") dim x integer x = 0 dim current_range range set current_range = cell_range dim actual_test_range string actual_test_range = current_range.offset(0, x).address current_range.offset(0, x).formula = "=if(" & current_range.offset(0, x).address & "= "apples",1,0)" x = x + 1 loop until x = 60

the thought if cell in current range = "apples" homecoming 1 else homecoming 0

i cannot work vba won't take "apples" located , don't know how build string formula out of variables , hard coded strings.

please help.

thanks.

you need double quotes when used within quoted string (i.e. formula) looks might circular reference in inserting formula cell references itself.

current_range.offset(0, x).formula = "=if(" & current_range.offset(0, x).address & "= ""apples"",1,0)"

vba

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -