Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 2003 pasting results from Access into excel number as text error

Status
Not open for further replies.

vba317

Programmer
Mar 5, 2009
708
0
0
US
Whenever I try and paste data into an excel spreadsheet I get the number as text error in every column that has a number in it. After researching the issue I found some code that does go through the columns and formats them into a number, but the code goes into an endless loop. What can I add to the code to make it stop once the loop has gone through any cell with something in it?



Code:
Sub ConvertToDouble()

'Converts numbers stored as text to type Double
Dim cell As Range

For Each cell In Selection
If Not IsEmpty(cell) And IsNumeric(cell.Value) Then
cell.Value = CDbl(cell.Value)
End If
Next cell

End Sub
 
I ran the macro again and it worked as advertised. So No help is needed.
 
hi,
Code:
Sub ConvertToNUMBER()

[b]    'Converts numbers stored as text to number as there is really no integer, single, double in excel
    'a number is a number.
    'however a number can be FORMATTED to DISPLAY in a whole bunch of different ways as necessary.
[/b]
    Dim cell As Range
    
    For Each cell In Selection
        With cell
            .NumberFormat = "General"
            .Value = .Value
        End With
    Next cell

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top