Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Need help converting number string to number

I am trying to figure out how to convert a number string, like "11291", to a
number 11291. I am trying to use it in the following If statement:

If Right(SAPws.Name, 5) = SAPws.Range("B2").Value Then

Right(SAPws.Name, 5) evaluates as a string: "11291", and
SAPws.Range("B2").Value evaluates as a number: 11291

I need to get the if statement to evaluate to TRUE. Please help.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Need help converting number string to number


If cDbl(Right(SAPws.Name, 5)) = SAPws.Range("B2").Value Then
--
Jim Cone
Portland, Oregon USA



"Ayo"

wrote in message

I am trying to figure out how to convert a number string, like "11291", to a
number 11291. I am trying to use it in the following If statement:

If Right(SAPws.Name, 5) = SAPws.Range("B2").Value Then

Right(SAPws.Name, 5) evaluates as a string: "11291", and
SAPws.Range("B2").Value evaluates as a number: 11291
I need to get the if statement to evaluate to TRUE. Please help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default Need help converting number string to number

Wrapping both sides of the equation in Cstr() (convert number to string)
should do the trick.

if Cstr(Right(SAPws.Name, 5)) = cstr(SAPws.Range("B2").Value) then
--
Steve

"Ayo" wrote in message
...
I am trying to figure out how to convert a number string, like "11291", to
a
number 11291. I am trying to use it in the following If statement:

If Right(SAPws.Name, 5) = SAPws.Range("B2").Value Then

Right(SAPws.Name, 5) evaluates as a string: "11291", and
SAPws.Range("B2").Value evaluates as a number: 11291

I need to get the if statement to evaluate to TRUE. Please help.

  #4   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Need help converting number string to number

Thanks.

"AltaEgo" wrote:

Wrapping both sides of the equation in Cstr() (convert number to string)
should do the trick.

if Cstr(Right(SAPws.Name, 5)) = cstr(SAPws.Range("B2").Value) then
--
Steve

"Ayo" wrote in message
...
I am trying to figure out how to convert a number string, like "11291", to
a
number 11291. I am trying to use it in the following If statement:

If Right(SAPws.Name, 5) = SAPws.Range("B2").Value Then

Right(SAPws.Name, 5) evaluates as a string: "11291", and
SAPws.Range("B2").Value evaluates as a number: 11291

I need to get the if statement to evaluate to TRUE. Please help.


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
Converting string to number kenppy New Users to Excel 9 March 5th 10 07:18 PM
Converting a string into a number format Albert Excel Discussion (Misc queries) 1 April 17th 08 10:18 AM
Converting string of letters to Number sebkavam Excel Discussion (Misc queries) 6 July 26th 06 10:50 PM
converting number string to number with decimal rortiz Excel Worksheet Functions 2 September 15th 05 08:34 PM
converting number to string No Name Excel Programming 5 January 23rd 04 07:38 PM


All times are GMT +1. The time now is 08:10 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"