Ask Your Question
0

Changing variable in a formula (Updating input of function)

asked 2016-08-16 13:41:49 +0200

mustafaxfe gravatar image

updated 2016-08-16 15:02:16 +0200

Hi,

I have started to write a macro to create document easily.

It is going to finish but I found a mistake in my macro. When I update input of my function, it updates variable of my formula. But it gives error.

My Formula:

oCellYD.setFormula("=K" & iRowYD + 1 "*L" & iRowYD + 1 "*N" & iRowYD + 1 & "*M" & iRowYD + 1 & "/O" & iRowYD + 1)

It gives error. That is:

"BASIC syntax error. Parentheses do not match."

I guess, it is about iRowYD variable. Every time, I call my function, iRowYD variable changes(increases).

Where should I change to fix this issue.

Sorry for my bad English. Thanks for your time.

edit retag flag offensive close merge delete

Comments

Is this about passing a parameter to a 'Sub' or about needing a loop to vary the iRowYD value or about ... ???
Would you mind to explain for what reason you think you need this complicated construct? On the formula level your task might better be done by =PROD(OFFSET(K1;iStartYD;0;1;4)). Again we may have the need to pass iAtartYD. ... See above.

Lupp gravatar imageLupp ( 2016-08-16 14:39:31 +0200 )edit

I have created a sub routine and created a loop to call this subroutine but it fails. I says Parentheses do not match.

Where should I change to fix this issue

mustafaxfe gravatar imagemustafaxfe ( 2016-08-16 14:49:14 +0200 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2016-08-16 15:37:43 +0200

erAck gravatar image

It seems to me you missed to add a & operator at two places. Try if this works:

oCellYD.setFormula("=K" & iRowYD + 1 & "*L" & iRowYD + 1 & "*N" & iRowYD + 1 & "*M" & iRowYD + 1 & "/O" & iRowYD + 1)
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-08-16 13:41:49 +0200

Seen: 79 times

Last updated: Aug 16 '16