Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Formatted Number into String Variable, Excel VBA

Hello All,

I am using a script to take a list of phone numbers formatting them and
then doing a search with the phone number. I need to use the formatted
phone number to do the search.

Cell(2,3) before code is 12345678901
after code is +1 (234) 567 8901
Code Snippet:

Dim telephone as String
Columns("C:C").Select
Selection.NumberFormat = "+# (###) ### ####"
telephone = Cells(2,3).Value

End Code

The problem is that the variable "telephone" is equal to 12345678901
not the formatted +1 (234) 567 8901. Is there a way to convert the
formatted number into a string in VBA?

Excel 2003 VBA

Thanks in advanced
Matt

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Formatted Number into String Variable, Excel VBA

Matt,

telephone = Format(Selection, "+# (###) ### ####")

hth,

Doug


wrote in message
oups.com...
Hello All,

I am using a script to take a list of phone numbers formatting them and
then doing a search with the phone number. I need to use the formatted
phone number to do the search.

Cell(2,3) before code is 12345678901
after code is +1 (234) 567 8901
Code Snippet:

Dim telephone as String
Columns("C:C").Select
Selection.NumberFormat = "+# (###) ### ####"
telephone = Cells(2,3).Value

End Code

The problem is that the variable "telephone" is equal to 12345678901
not the formatted +1 (234) 567 8901. Is there a way to convert the
formatted number into a string in VBA?

Excel 2003 VBA

Thanks in advanced
Matt



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Formatted Number into String Variable, Excel VBA

or simpler

telephone = Cells(2,3).Text

No use repeating yourself. <g

--
Regards,
Tom Ogilvy

"Doug Glancy" wrote in message
...
Matt,

telephone = Format(Selection, "+# (###) ### ####")

hth,

Doug


wrote in message
oups.com...
Hello All,

I am using a script to take a list of phone numbers formatting them and
then doing a search with the phone number. I need to use the formatted
phone number to do the search.

Cell(2,3) before code is 12345678901
after code is +1 (234) 567 8901
Code Snippet:

Dim telephone as String
Columns("C:C").Select
Selection.NumberFormat = "+# (###) ### ####"
telephone = Cells(2,3).Value

End Code

The problem is that the variable "telephone" is equal to 12345678901
not the formatted +1 (234) 567 8901. Is there a way to convert the
formatted number into a string in VBA?

Excel 2003 VBA

Thanks in advanced
Matt





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Formatted Number into String Variable, Excel VBA

Thanks Tom,

Your right, things are complicated enough as it is.

Doug


"Tom Ogilvy" wrote in message
...
or simpler

telephone = Cells(2,3).Text

No use repeating yourself. <g

--
Regards,
Tom Ogilvy

"Doug Glancy" wrote in message
...
Matt,

telephone = Format(Selection, "+# (###) ### ####")

hth,

Doug


wrote in message
oups.com...
Hello All,

I am using a script to take a list of phone numbers formatting them and
then doing a search with the phone number. I need to use the formatted
phone number to do the search.

Cell(2,3) before code is 12345678901
after code is +1 (234) 567 8901
Code Snippet:

Dim telephone as String
Columns("C:C").Select
Selection.NumberFormat = "+# (###) ### ####"
telephone = Cells(2,3).Value

End Code

The problem is that the variable "telephone" is equal to 12345678901
not the formatted +1 (234) 567 8901. Is there a way to convert the
formatted number into a string in VBA?

Excel 2003 VBA

Thanks in advanced
Matt







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
Extract a number from a variable text string tipsy Excel Discussion (Misc queries) 4 May 4th 08 03:28 AM
Find a specific formatted string in a cell KCK Excel Worksheet Functions 1 April 16th 08 09:16 PM
can i change a number formatted as positive to negative in Excel byron miranda Excel Discussion (Misc queries) 2 May 16th 06 03:01 PM
how to get the number of days between two date formatted fields in vba for excel? Daniel Excel Worksheet Functions 1 July 12th 05 01:53 AM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM


All times are GMT +1. The time now is 08:06 AM.

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

About Us

"It's about Microsoft Excel"