syntax - Excel VBA - 1004 run-time error, Application or object-defined error -



syntax - Excel VBA - 1004 run-time error, Application or object-defined error -

i'm trying go through range of cells in worksheet , write formula in each one. maintain getting error:

run-time error '1004' application-defined or object-defined error

the code looks right now:

sub updateformulasfornamedrange() 'application.calculation = xlcalculationmanual 'application.screenupdating = false dim row, col, fieldcount integer colcount = 13 rowcount = 60 col = 1 colcount row = 1 rowcount dim strcolcharacter if col > 26 strcolcharacter = chr(int((row - 1) / 26) + 64) & chr(((row - 1) mod 26) + 65) else strcolcharacter = chr(row + 64) end if worksheets("rawdata1").cells(row, col).formular1c1 = "=if(numbers1!$e$" & col & "<>0;numbers1!" & "$" & strcolcharacter & "$" & row & ";"""")" next row next col 'application.calculation = xlcalculationautomatic 'application.screenupdating = true end sub

it fails @ line assign formula cell. tried replace string "test" , works. it's string that's not accepted. though it's exact same string that's in formula bar of exact cell. , string looks fine me?

"=if(numbers1!$e$1<>0;numbers1!$a$1;"")"

i don't quite know difference of formula properties, i've tried variant of them , throw same error. causing error?

your problem .formular1c1. tells formula expect row number, column number style formula reference, give address (column, row) style formula.

change .formular1c1 .formula

excel-vba syntax excel-formula

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -