LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
GB GB is offline
external usenet poster
 
Posts: 230
Default error convert to number macro

Well even so, I just took a blank cell, recorded a macro of setting the
Selection.NumberFormat = "0.00"

What I would do is loop through each cell in the desired range, if the text
of the cell isnumeric then select the cell and change the numberformat to the
desired format.
Ie.
For I = StartRow to EndRow
If IsNumeric(Application.Cells(I, ColumnLocation).Text) = true then
Application.Cells(I, ColumnLocation).NumberFormat = "0.00"
end if
Next I

I also did a little investigation about ensuring that the data in the cell
is actually numeric. If in the import it prepends the data with an
apostrophe, you can use the RIGHT function to work only with the portion of
the string that may or may not be numeric. You might also have to reset the
cells.value to your newly discovered "number" instead of the text present.

Some ideas, not perhaps a final answer, but somewhere to work from.
Maybe someone else can help you further?

Of course substituting
"cherrynich" wrote:

I tried that before I posted. You start recording and then convert one, then
stop recording and look at the code, and there isn't any code. Thank you
though.

 
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
Vlookup Error, how to convert Text to Number claude jerry Excel Discussion (Misc queries) 15 December 22nd 07 11:06 PM
convert number to text w/ error checking sign lynn Excel Worksheet Functions 1 June 6th 07 04:38 PM
Convert a number formatted as text to a number in a macro MACRE0[_5_] Excel Programming 2 October 22nd 05 02:51 AM
convert text-format number to number in excel 2000%3f Larry Excel Discussion (Misc queries) 1 July 29th 05 08:18 PM
convert decimal number to time : convert 1,59 (minutes, dec) to m agenda9533 Excel Discussion (Misc queries) 8 January 20th 05 10:24 PM


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