admin管理员组文章数量:1129155
I am trying to automate Goal Seek functions across a large number of data sets weherein the Rate is to be derived (through Goal Seek) such that the NPV at that rate is equal to the Target NPV.
This might be a very basic query, but I ll still ask : I am getting a Syntax error in running the Do Until Loop. My code is as follows:
Sub Macro3()
Do Loop Until Range("Target_NPV_Delta") = 0
Range("Target_NPV").GoalSeek Goal:=Range("NPV_Calc"), ChangingCell:=Range("Rate")
Loop
End Sub
I am able to srite the code without the range function. But moment i introduce range function, it shows Compile Error.
I am trying to automate Goal Seek functions across a large number of data sets weherein the Rate is to be derived (through Goal Seek) such that the NPV at that rate is equal to the Target NPV.
This might be a very basic query, but I ll still ask : I am getting a Syntax error in running the Do Until Loop. My code is as follows:
Sub Macro3()
Do Loop Until Range("Target_NPV_Delta") = 0
Range("Target_NPV").GoalSeek Goal:=Range("NPV_Calc"), ChangingCell:=Range("Rate")
Loop
End Sub
I am able to srite the code without the range function. But moment i introduce range function, it shows Compile Error.
Share Improve this question edited Jan 8 at 13:41 Shrotter 6301 gold badge5 silver badges16 bronze badges asked Jan 8 at 10:31 nikhil kshirsagarnikhil kshirsagar 1 New contributor nikhil kshirsagar is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.1 Answer
Reset to default 0That is the wrong syntax for Do
it should read
Sub Macro3()
Do Until Range("Target_NPV_Delta") = 0
Range("Target_NPV").GoalSeek Goal:=Range("NPV_Calc"),
ChangingCell:=Range("Rate")
Loop
End Sub
本文标签: excelSyntax error in Macro Function seeking Goal SeekStack Overflow
版权声明:本文标题:excel - Syntax error in Macro Function seeking Goal Seek - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736739826a1950448.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论