Is there a limit to "Evaluate" in VBA

jcg31

Board Regular
Joined
Aug 20, 2006
Messages
176
I have an application that uses Evaluate.

Calcit = "Y794 + Y873 + Y907 + Y946 + Y980 + Y1042 + Y526 + Y567 . . ."
FinalNum= Worksheet(Name).Evaluate (Calcit)

I am finding that Evaluate will not sum more than 32 cells arranged as above. Is this the case and if so is there a way around it?

Thanks,
Jim
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Hi jcg31,

An idea would be to include all that cells in a unique range. Define the range containing those cells,
as they are non contiguous cells, I think "Union" command could help. After that you can use SUM(Range)
within Evaluate, something like:

Code:
[COLOR=Navy]x=Evaluate("[/COLOR][COLOR=Navy]SUM(Range)[/COLOR][COLOR=Navy]")[/COLOR]

You can try, It's only an idea.

Hope this helps.

Regards.
 
Last edited:
Upvote 0
Thanks,
the issue is that the user is selecting non contiguous cells and operands to create the formula being evaluated. So rather than a series of sums it could be ((k112/k32*23)+27)/k23. it just happens that I noticed that a series of sums above 32 fails, and while it isn't likely to occur frequently it was a problem I wanted to correct.

Jim
 
Upvote 0
So I am finding out that there is a 255 character limit to the string being evaluated, but so far no work around.

Jim
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,866
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top