Excel VBA - Loop to insert formulas -


i've come across worksheet full of formulas mistakes. project repetitive decided write simple vba code in order save me time.

the problem code did not work. thought indeed simple problem has been pain in neck.

i've cut out repetting pieces of code make easier understand.

sub corrigirerro()     dim r, integer      r = 17 28         = r - 16             worksheets(r).select             range("d73").clearcontents             range("d73").formula = "=seerro(somarproduto('rd - " & & "'!d266:d268;'rd - " & & "'!e266:e268)/soma('rd - " & & "'!d266:d268);0)" 

your formula using semi-colon system has set list separator in regional settings. vba sets range .formula property comma regardless of regional settings have range .formulalocal property use regional settings.

    range("d73").formula = "=seerro(somarproduto('rd - " & & "'!d266:d268, 'rd - " & & "'!e266:e268)/soma('rd - " & & "'!d266:d268), 0)"     range("d73").formulalocal = "=seerro(somarproduto('rd - " & & "'!d266:d268; 'rd - " & & "'!e266:e268)/soma('rd - " & & "'!d266:d268); 0)" 

switch formula commas or use .formulalocal property.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -