Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default custom function to convert numbers stored as text

Hi everyone,

I know you can convert text to numbers with the whole paste multiply by 1
thing but I was wondering if anyone had seen code (or would know what code to
use) to convert numbers stored as text to numbers using a custom built VBA
function?

Any help greatly appreciated!

Josh
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default custom function to convert numbers stored as text

Not sure what you mean, but here is a function that will convert a string
value digit to an integer value.

Function MakeNum(rng As Range)
MakeNum = CInt(rng)
End Function

To use it, assume a string value of "123456" in cell b5:

In an empty cell put formula =MakeNum(b5) Enter.

"Josh Craig" wrote in message
...
Hi everyone,

I know you can convert text to numbers with the whole paste multiply by 1
thing but I was wondering if anyone had seen code (or would know what code
to
use) to convert numbers stored as text to numbers using a custom built VBA
function?

Any help greatly appreciated!

Josh



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default custom function to convert numbers stored as text

There is no direct functions to convert this. For a VBA solution check out
the below links

http://support.microsoft.com/kb/213360
http://www.ozgrid.com/VBA/ValueToWords.htm
http://www.xldynamic.com/source/xld.xlFAQ0004.html

--
Jacob


"Josh Craig" wrote:

Hi everyone,

I know you can convert text to numbers with the whole paste multiply by 1
thing but I was wondering if anyone had seen code (or would know what code to
use) to convert numbers stored as text to numbers using a custom built VBA
function?

Any help greatly appreciated!

Josh

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default custom function to convert numbers stored as text

Josh,

There is no way of knowing what you truly mean because you didn't provide an
example (as was mentioned in a prior post). However, if you have a numeric
value in the spreadsheet and the spreadsheet is treating that numeric value
as text, then here are two built-in Excel ways that should get that text into
a number.

(1) In a separate cell: =NumberTextCell+1-1. Copy (new formula cells)-Paste
Special-Values
(2) Place a 1 somewhere on the spreadsheet. Copy the 1-select numeric cells
that are text-Paste Special-Multiply

Best,

Matthew Herbert

"Josh Craig" wrote:

Hi everyone,

I know you can convert text to numbers with the whole paste multiply by 1
thing but I was wondering if anyone had seen code (or would know what code to
use) to convert numbers stored as text to numbers using a custom built VBA
function?

Any help greatly appreciated!

Josh

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default custom function to convert numbers stored as text

OR do you mean code to conver to numbers

Dim cell As Range
For Each cell In Selection
If cell.Text < "" And IsNumeric(cell.Value) Then
cell.Value = Val(cell.Text)
cell.NumberFormat = "General"
End If
Next

--
Jacob


"Jacob Skaria" wrote:

There is no direct functions to convert this. For a VBA solution check out
the below links

http://support.microsoft.com/kb/213360
http://www.ozgrid.com/VBA/ValueToWords.htm
http://www.xldynamic.com/source/xld.xlFAQ0004.html

--
Jacob


"Josh Craig" wrote:

Hi everyone,

I know you can convert text to numbers with the whole paste multiply by 1
thing but I was wondering if anyone had seen code (or would know what code to
use) to convert numbers stored as text to numbers using a custom built VBA
function?

Any help greatly appreciated!

Josh

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 numbers stored as text to numbers Jacob Skaria Excel Discussion (Misc queries) 0 September 17th 09 01:56 PM
Convert numbers stored as text to numbers Stig - tame racing driver Excel Discussion (Misc queries) 5 November 14th 08 10:10 AM
Convert numbers stored as text to numbers Excel 2000 Darlene Excel Discussion (Misc queries) 6 January 31st 06 08:04 PM
How do I convert numbers stored as text with spaces to numbers Baffuor Excel Discussion (Misc queries) 1 May 24th 05 07:39 AM


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