PC Review


Reply
Thread Tools Rate Thread

Convert a number formatted as text to a number in a macro

 
 
MACRE0
Guest
Posts: n/a
 
      21st Oct 2005

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

 
Reply With Quote
 
 
 
 
Tom Ogilvy
Guest
Posts: n/a
 
      21st Oct 2005
If '12345

is in the active Cell

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

End Sub

--
Regards,
Tom Ogilvy


"MACRE0" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
>
> 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
>



 
Reply With Quote
 
MACRE0
Guest
Posts: n/a
 
      22nd Oct 2005

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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to convert a number to text (English only) John Google Microsoft Excel Discussion 4 18th Nov 2007 10:08 PM
Help - Excel 97 Macro convert Text to Number John Thomas Smith Microsoft Excel Discussion 6 4th Oct 2005 07:34 PM
convert text-format number to number in excel 2000%3f =?Utf-8?B?TGFycnk=?= Microsoft Excel Misc 1 29th Jul 2005 08:18 PM
Convert number formatted as currency to text including the $, com. =?Utf-8?B?c2hydXQ=?= Microsoft Access 1 1st Mar 2005 03:14 PM
formula/function to change a number formatted as text to being an actual number =?Utf-8?B?Sm9l?= Microsoft Excel Misc 2 16th Dec 2003 07:51 PM


Features
 

Advertising
 

Newsgroups
 


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