Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Convert a number formatted as text to a number in a macro


Anyone have a simple macro that converts a number in a cell that was
formatted as text or proceeded by an apostrophe?

Or a work around
Coverting " 12345 - xyz"

Selection.Copy
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(0, -1).Range("A1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=MID(RC[1],3,7)"
ActiveCell.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues

to "12345" such that a vlookup can then match this to "12345" that's
formatted as a number already.

Thanks for any and all help!


--
MACRE0
------------------------------------------------------------------------
MACRE0's Profile: http://www.excelforum.com/member.php...o&userid=10848
View this thread: http://www.excelforum.com/showthread...hreadid=478087

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Convert a number formatted as text to a number in a macro

If '12345

is in the active Cell

Sub aaa()
ActiveCell.NumberFormat = "General"
ActiveCell.Value = ActiveCell.Value

End Sub

--
Regards,
Tom Ogilvy


"MACRE0" wrote in
message ...

Anyone have a simple macro that converts a number in a cell that was
formatted as text or proceeded by an apostrophe?

Or a work around
Coverting " 12345 - xyz"

Selection.Copy
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(0, -1).Range("A1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=MID(RC[1],3,7)"
ActiveCell.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues

to "12345" such that a vlookup can then match this to "12345" that's
formatted as a number already.

Thanks for any and all help!


--
MACRE0
------------------------------------------------------------------------
MACRE0's Profile:

http://www.excelforum.com/member.php...o&userid=10848
View this thread: http://www.excelforum.com/showthread...hreadid=478087



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Convert a number formatted as text to a number in a macro


I appreciate it, thanks.


--
MACRE0
------------------------------------------------------------------------
MACRE0's Profile: http://www.excelforum.com/member.php...o&userid=10848
View this thread: http://www.excelforum.com/showthread...hreadid=478087

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
Convert text number to number formate [email protected] Excel Discussion (Misc queries) 2 April 9th 07 10:48 AM
Use formatted text instead of number value... Rod Janson New Users to Excel 3 September 5th 06 02:51 PM
convert text-format number to number in excel 2000%3f Larry Excel Discussion (Misc queries) 1 July 29th 05 08:18 PM
not able to convert text, or graphic number to regular number in e knutsenk Excel Worksheet Functions 1 April 2nd 05 08:41 AM
Convert number in text format to number Cheryl[_3_] Excel Programming 2 May 25th 04 06:51 PM


All times are GMT +1. The time now is 04:27 PM.

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"