ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   evaluate error (https://www.excelbanter.com/excel-programming/378920-evaluate-error.html)

x taol

evaluate error
 
Sub dd()
MsgBox
Application.Evaluate("=ROUND(C5*H5*G5*IF(B15=""12. 7mm"",0.774,1.101)-IF(
C5<3,0,H5*IF(B15=""12.7mm"",0.774,1.101)*(SUMPRODU CT((ROW(INDIRECT(""1:"
"&INT((C5-1)/2)))*K15)*2)-IF(MOD(C5,2),K15*INT(C5/2),0))),0)")
End Sub

this function is not working.
but the function is work well in worksheet.





*** Sent via Developersdex http://www.developersdex.com ***

Peter T

evaluate error
 
It was a bit fiddly to reconstruct but I get Cell formula and Evaluate
return same for me. IOW it seems to work fine.

Regards,
Peter T

"x taol" wrote in message
...
Sub dd()
MsgBox
Application.Evaluate("=ROUND(C5*H5*G5*IF(B15=""12. 7mm"",0.774,1.101)-IF(
C5<3,0,H5*IF(B15=""12.7mm"",0.774,1.101)*(SUMPRODU CT((ROW(INDIRECT(""1:"
"&INT((C5-1)/2)))*K15)*2)-IF(MOD(C5,2),K15*INT(C5/2),0))),0)")
End Sub

this function is not working.
but the function is work well in worksheet.





*** Sent via Developersdex http://www.developersdex.com ***




Bob Phillips

evaluate error
 
It worked fine for me (albeit in limited testing), it gave the same result
as the worksheet.

I restructured it to make it more readable

MsgBox
Application.Evaluate("=ROUND(C5*H5*G5*IF(B15=""12. 7mm"",0.774,1.101)-" & _
"IF(C5<3,0,H5*IF(B15=""12.7mm"",0.774,1.101)*" & _
"(SUMPRODUCT((ROW(INDIRECT(""1:""&INT((C5-1)/2)))*K15)*2)-" & _
"IF(MOD(C5,2),K15*INT(C5/2),0))),0)")


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"x taol" wrote in message
...
Sub dd()
MsgBox
Application.Evaluate("=ROUND(C5*H5*G5*IF(B15=""12. 7mm"",0.774,1.101)-IF(
C5<3,0,H5*IF(B15=""12.7mm"",0.774,1.101)*(SUMPRODU CT((ROW(INDIRECT(""1:"
"&INT((C5-1)/2)))*K15)*2)-IF(MOD(C5,2),K15*INT(C5/2),0))),0)")
End Sub

this function is not working.
but the function is work well in worksheet.





*** Sent via Developersdex http://www.developersdex.com ***





All times are GMT +1. The time now is 03:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com