Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default dim a String A="2+3+5" A=cdbl(A)???

If I have a string such as:

a="1+5+9+7"

and I want to use the number, non the string, I mean if I want to ge
the answer=22

a=cdbl(A) does not work!
How can I do this?

PS: I need this

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default dim a String A="2+3+5" A=cdbl(A)???

Sure thing

Sub test()
Dim A As String, D As Double
A = "1+5+9+7"
D = Evaluate(A)
MsgBox D, , A
End Sub

HTH. Best wishes Harald

"Andoni " skrev i melding
...
If I have a string such as:

a="1+5+9+7"

and I want to use the number, non the string, I mean if I want to get
the answer=22

a=cdbl(A) does not work!
How can I do this?

PS: I need this!


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default dim a String A="2+3+5" A=cdbl(A)???

Ok if I am understanding this right you want D to show the
value of A correct. If this is so then change 'D = Evaluate
(A)' to 'D = A'. Also since A is a string you might have
to setup 'A = "1+5+9+7"' like this 'A = Integer
("1+5+9+7")' to get it to do the math. If I am incorrect
in this then a little more explanation of what your
attempting would help. What are you trying to do with this
information? Is this being displayed via a cell, or
through the msgBox?
Ascheman

-----Original Message-----
Sure thing

Sub test()
Dim A As String, D As Double
A = "1+5+9+7"
D = Evaluate(A)
MsgBox D, , A
End Sub

HTH. Best wishes Harald

"Andoni " skrev i

melding
...
If I have a string such as:

a="1+5+9+7"

and I want to use the number, non the string, I mean if

I want to get
the answer=22

a=cdbl(A) does not work!
How can I do this?

PS: I need this!


---
Message posted from http://www.ExcelForum.com/



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default dim a String A="2+3+5" A=cdbl(A)???

I copied the suggested code into a module and ran it. It
does what is requested. I am not sure why, but it works!
Help provides information but not much help on this.

I hope that helps!

Kevin
-----Original Message-----
Ok if I am understanding this right you want D to show

the
value of A correct. If this is so then change 'D =

Evaluate
(A)' to 'D = A'. Also since A is a string you might have
to setup 'A = "1+5+9+7"' like this 'A = Integer
("1+5+9+7")' to get it to do the math. If I am incorrect
in this then a little more explanation of what your
attempting would help. What are you trying to do with

this
information? Is this being displayed via a cell, or
through the msgBox?
Ascheman

-----Original Message-----
Sure thing

Sub test()
Dim A As String, D As Double
A = "1+5+9+7"
D = Evaluate(A)
MsgBox D, , A
End Sub

HTH. Best wishes Harald

"Andoni " skrev

i
melding
...
If I have a string such as:

a="1+5+9+7"

and I want to use the number, non the string, I mean

if
I want to get
the answer=22

a=cdbl(A) does not work!
How can I do this?

PS: I need this!


---
Message posted from http://www.ExcelForum.com/



.

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default dim a String A="2+3+5" A=cdbl(A)???

If I am incorrect
Just for benefit of the OP since you have obfuscated the correct solution
provided by Harald, nothing you have said so far is correct.

Harald's method worked fine (except for including the string A in the
msgbox). Your suggestions don't work at all.

--
Regards,
Tom Ogilvy

"Ascheman" wrote in message
...
Ok if I am understanding this right you want D to show the
value of A correct. If this is so then change 'D = Evaluate
(A)' to 'D = A'. Also since A is a string you might have
to setup 'A = "1+5+9+7"' like this 'A = Integer
("1+5+9+7")' to get it to do the math. If I am incorrect
in this then a little more explanation of what your
attempting would help. What are you trying to do with this
information? Is this being displayed via a cell, or
through the msgBox?
Ascheman

-----Original Message-----
Sure thing

Sub test()
Dim A As String, D As Double
A = "1+5+9+7"
D = Evaluate(A)
MsgBox D, , A
End Sub

HTH. Best wishes Harald

"Andoni " skrev i

melding
...
If I have a string such as:

a="1+5+9+7"

and I want to use the number, non the string, I mean if

I want to get
the answer=22

a=cdbl(A) does not work!
How can I do this?

PS: I need this!


---
Message posted from http://www.ExcelForum.com/



.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default dim a String A="2+3+5" A=cdbl(A)???

Could you please clarify a little more on how / where you
have this setup. Is the string in the code? Are you
attempting to get the result of the string into a cell?
More information will make it easier to determine what you
are attempting to do, and there by allow for better help.
Ascheman

-----Original Message-----
If I have a string such as:

a="1+5+9+7"

and I want to use the number, non the string, I mean if I

want to get
the answer=22

a=cdbl(A) does not work!
How can I do this?

PS: I need this!


---
Message posted from http://www.ExcelForum.com/

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
=SUBSTITUTE(C4,"~?#","") will this work to remove multiple string Raja Mahendiran S Excel Worksheet Functions 6 May 12th 10 09:10 PM
Converting "uppercase" string data to "lower case" in CSV file [email protected] Excel Discussion (Misc queries) 2 August 12th 08 08:36 PM
text string: "91E10" in csv file auto converts to: "9.10E+11" [email protected] Excel Discussion (Misc queries) 2 August 12th 08 03:13 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM


All times are GMT +1. The time now is 07:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"