View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
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?