View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
T Lavedas T Lavedas is offline
external usenet poster
 
Posts: 38
Default Evaluate text formula in VBA

On May 22, 2:35 pm, Gvaram wrote:
Thank you very much Bob

"Bob Phillips" wrote:
The problem it is not CCA as a variable, but as part of teh string, as is
the " and the &.


I beg to differ with Mr. Phillips original assessment. I believe the
problem was with the string stored in the database. This worked for
me ...

Sub test()
CCA = 22
CCB = 1200
hhhh = "AND(" & CCA & "<30, " & CCB & "800)"
MsgBox Evaluate(hhhh)
End Sub

Note that all I did was add a leading and a trailing double quote to
the 'rule' string.

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/