here is my qustion

here is my qustion

Anonymous
Not applicable
238 Views
3 Replies
Message 1 of 4

here is my qustion

Anonymous
Not applicable
hi,

here is my qustion.

Private Sub CommandButton1_Click()
Dim susuki1 As String Dim i As Integer
a = 2
b = 2
H = Replace(susuki, "a", " 2 ")
H = Replace(H, "b", " 2 ")

MyLen = Len(H)
H = mid(H, 2, MyLen - 1)
MsgBox Val(H)
End Sub

i just want the result to be a double instead of a text.(
for exemple ,to be 4 instead of 2+2)

would you like me to tell me how to do it.

as a matter of fact susuki1 is a formula and a ,b are both variants,that is
to say they are not always 2s.

thank you.

with regards
0 Likes
239 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
I found it very difficult to follow your example, but perhaps you might find the Eval method useful.



Regards



Wayne Ivory

IT Analyst Programmer

Wespine Industries Pty Ltd
0 Likes
Message 3 of 4

Anonymous
Not applicable
Thanks for your advice.

but eval method fails to give me a
value.

anything else will be
appreciated.

in fact i do want an evaluate method
(there is one in excel vba )

 

thanks

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
found it very difficult to follow your example, but perhaps you might find the
Eval method useful.
  
Regards
  
Wayne
Ivory
IT Analyst Programmer
Wespine Industries Pty Ltd

0 Likes
Message 4 of 4

Anonymous
Not applicable
youngman wrote:

> as a matter of fact susuki1 is a formula and a ,b are both
> variants,that is to say they are not always 2s.

I take you mean to say that susuki1 is something like "a + 2" and you
would like to perform a substitution then evaluate the formula. If so,
search the net for "postfix notation". You should find plenty of
examples of how to reliably and generically evaluate a simple algebraic
expression.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
0 Likes