ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Evalute Array Formula in VBA code (https://www.excelbanter.com/excel-programming/398275-evalute-array-formula-vba-code.html)

[email protected]

Evalute Array Formula in VBA code
 
Hey

I have this string that is programatically inserted into a cell as an
array formula:
=1*MID(A2,MATCH(FALSE,ISERROR(1*MID(A2,ROW(INDIREC T("1:"&LEN(A2))),1)),
0),LEN(A2)-SUM(1*ISERROR(1*MID(A2,ROW(INDIRECT("1:"&LEN(A2))) ,1))))


It returns a valid result. I would like to be able to evaluate this
formula and get the result in VBA before I insert it into a cell.

How do I do this?


Thanks


Bob Phillips

Evalute Array Formula in VBA code
 
MsgBox Activesheet.Evaluate( _
"1*MID(A2,MATCH(FALSE,ISERROR(1*MID(A2,ROW(INDIREC T(" & _
"""1:""&LEN(A2))),1)),0),LEN(A2)-SUM(1*ISERROR(1*MID(A2,ROW(" & _
"INDIRECT(""1:""&LEN(A2))),1))))")

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



wrote in message
ps.com...
Hey

I have this string that is programatically inserted into a cell as an
array formula:
=1*MID(A2,MATCH(FALSE,ISERROR(1*MID(A2,ROW(INDIREC T("1:"&LEN(A2))),1)),
0),LEN(A2)-SUM(1*ISERROR(1*MID(A2,ROW(INDIRECT("1:"&LEN(A2))) ,1))))


It returns a valid result. I would like to be able to evaluate this
formula and get the result in VBA before I insert it into a cell.

How do I do this?


Thanks




[email protected]

Evalute Array Formula in VBA code
 
That gave me a runtime error 13 Type Mismatch



All times are GMT +1. The time now is 09:17 AM.

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