Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default Convert to number

Hi all -

I have a spreadsheet which queries an external database. On returning
the data, it treats numbers as text. The drop-down 'error arrow'
appears, inviting me to convert it to a number, which is exactly what I
want to do.

I need this to be done every time, so I tried recording a Macro to run
for me when I chose to convert it but no code was generated by the
macro recorder.

Does anyone know what code I need to use to simulate this error
correcting feature?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Convert to number

Without code:

Put a 1 in an un-used cell and copy the cell.
Select the cells you want to convert and paste/special with the multiply
button checked.

With code:

Sub Macro1()
Dim r As Range
For Each r In Selection
r.Value = 1# * r.Value
Next
End Sub

--
Gary's Student


"JakeyC" wrote:

Hi all -

I have a spreadsheet which queries an external database. On returning
the data, it treats numbers as text. The drop-down 'error arrow'
appears, inviting me to convert it to a number, which is exactly what I
want to do.

I need this to be done every time, so I tried recording a Macro to run
for me when I chose to convert it but no code was generated by the
macro recorder.

Does anyone know what code I need to use to simulate this error
correcting feature?


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 number to % using only custom number format challenge Brotherharry Excel Discussion (Misc queries) 7 June 2nd 09 06:29 PM
Convert a number formatted as text to a number in a macro MACRE0[_5_] Excel Programming 2 October 22nd 05 02:51 AM
how do I convert a number to number of years, months and days because Excel Worksheet Functions 2 October 12th 05 06:15 PM
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 01:04 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"