ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Properly Saving a .CSV File With an 11 Digit Numeric Field (https://www.excelbanter.com/excel-programming/445299-re-properly-saving-csv-file-11-digit-numeric-field.html)

nz rb

Properly Saving a .CSV File With an 11 Digit Numeric Field
 
here is a snippet of my code, from research i did on this problem. basically, if excel sees/displays it in a certain way (as in it drops seconds in the date time, for instance), thats how it converts it. thus, you have to custom-set the format of the cell/column

'Have to update dateformat in column H because conversion to csv will drop seconds
'if excel doesnt see complete format

'find last row to apply number format to
Dim iLastRow
iLastRow = Mid(Range("H65536").End(xlUp).Address(0, 0), 2)

Range("H6").Select
Range(Selection, Selection.End(xlDown)).Select
Range("H6:H" & iLastRow).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.NumberFormat = "m/d/yyyy hh:mm:ss"



-hth

On Monday, September 13, 2010 2:22 PM Sheldon Potolsky wrote:


My VBA code saves a spreadsheet as a .csv (... FileFormat:=xlCSV).
The problem? The one numeric field, an eleven digit number, converts
to exponential form, which I do not want.
Any way to do what I am trying to accomplish?

Thanks, Sheldon



On Monday, September 13, 2010 3:41 PM Mike S wrote:


On 9/13/2010 11:22 AM, Sheldon Potolsky wrote:

I do not know if this will help or not, using Excel 2000 when I format
the cells in a column containing numbers with 11 decimal points as text
and save the sheet as csv, the numbers are saved with all of the decimal
points, I can see that by opening the csv file with a text editor. But
when I open the csv file in Excel, only 9 of the decimal places are
displayed. I could not find a setting to restore displaying all 11 of
them anywhere, although one probably exists.

http://www.eggheadcafe.com/software/...-csv-file.aspx






All times are GMT +1. The time now is 03:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com