PC Review


Reply
Thread Tools Rate Thread

Convert numbers stored as text to numbers errors after loading data in

 
 
jobs
Guest
Posts: n/a
 
      27th Mar 2007
I have an excel spreedsheet that already has cells formated.

I'm trying to write data to excel from sql server (i've tried using
the jet 4.0 oledb driver and ssis's destination excel) however when I
write rows, it insist on loading data as text, so I get the excel cell
formating error tag on every cell. Any way around this?.

from another tool i've been able to work around this by writing this
to the top of the file, but that was for the web based version of
excel used by asp.net.

<style>.text { mso-number-format:\@; } </style>

the exact error is a green tag on every cell, help on it reads:

Convert numbers stored as text to numbers

 
Reply With Quote
 
 
 
 
merjet
Guest
Posts: n/a
 
      27th Mar 2007
Assuming you want VBA to convert them, something like:
Sheets("Sheet1").Range("A2:F100").NumberFormat = "0.0"
will do so. Change sheet name, Range and format to suit.

Hth,
Merjet


 
Reply With Quote
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      28th Mar 2007
To fix the cells that have already been entered:

Sub numerify()
Dim r As Range, rt As Range
Count = 0
Set rt = ActiveSheet.UsedRange.SpecialCells(xlCellTypeConstants, 2)
For Each r In rt
If IsNumeric(r.Value) Then
r.Value = 1# * r.Value
r.NumberFormat = "General"
Count = Count + 1
End If
Next
MsgBox (Count & " cells changed")
End Sub

--
Gary's Student
gsnu200712

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Numbers stored as Text to Numbers Emece Microsoft Excel Misc 2 30th Nov 2009 06:15 PM
Can I convert numbers stored as text back to numbers in MS Access CUserM Microsoft Access Queries 7 20th Jun 2008 08:12 PM
convert numbers stored as numbers to text =?Utf-8?B?R2VtbWFFaWR1a3M=?= Microsoft Excel Worksheet Functions 3 24th Jul 2006 09:02 PM
Convert numbers stored as text to numbers Excel 2000 =?Utf-8?B?RGFybGVuZQ==?= Microsoft Excel Misc 6 31st Jan 2006 08:04 PM
How do I convert numbers stored as text with spaces to numbers =?Utf-8?B?QmFmZnVvcg==?= Microsoft Excel Misc 1 24th May 2005 07:39 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:09 AM.