Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
I am saving a worksheet from Excel to .csv I have a number 0000457, but when
I open it up the .csv file then the zeros all goine. I can show them in Excel if I format the column as text. Need answer ASAP!! |
#2
![]() |
|||
|
|||
![]()
Type a ' before the number.
Hope this helps; if it does, please rate my post. G.Morales. "klafert" wrote: I am saving a worksheet from Excel to .csv I have a number 0000457, but when I open it up the .csv file then the zeros all goine. I can show them in Excel if I format the column as text. Need answer ASAP!! |
#3
![]() |
|||
|
|||
![]()
It gets stripped when opening it in excel, not when saving as CSV, you can
change it to a txt file and use the text import wizard and import it as text or if the number of digits are equal use a custom format like 0000000 Regards, Peo Sjoblom "klafert" wrote: I am saving a worksheet from Excel to .csv I have a number 0000457, but when I open it up the .csv file then the zeros all goine. I can show them in Excel if I format the column as text. Need answer ASAP!! |
#4
![]() |
|||
|
|||
![]()
That only works when the Spreadsheet is the the .xls format and not the .csv
format. "Mexage" wrote: Type a ' before the number. Hope this helps; if it does, please rate my post. G.Morales. "klafert" wrote: I am saving a worksheet from Excel to .csv I have a number 0000457, but when I open it up the .csv file then the zeros all goine. I can show them in Excel if I format the column as text. Need answer ASAP!! |
#5
![]() |
|||
|
|||
![]()
When I prefix a number in a CSV with a single quote, the single quote appears
in the cell. If I then select the cell, put my cursor in the edit bar and hit tab, it'll reinterpret the quote and treat the cell as text. Is there any way to write a macro that visits each cell and does this? (No, recording this into a macro does no good.) This seems to be a common problem- and no, treating it as a txt file and specifying all the formats is not a decent solution. I could write a perl script to do this (or presumably a Basic script), but that seems like a lot of work for a simple problem. |
#6
![]() |
|||
|
|||
![]()
I created a .csv file that looked like this:
'1234,'1234,'2345,'2345 '1234,'1234,'2345,'2345 '1234,'1234,'2345,'2345 '1234,'1234,'2345,'2345 '1234,'1234,'2345,'2345 '1234,'1234,'2345,'2345 And this worked ok: Option Explicit Sub testme02() Dim myCell As Range Dim myRng As Range With ActiveSheet Set myRng = Nothing On Error Resume Next Set myRng = .Cells.SpecialCells(xlCellTypeConstants, xlTextValues) On Error GoTo 0 End With If myRng Is Nothing Then MsgBox "No text values found" Exit Sub End If For Each myCell In myRng.Cells With myCell If Left(.Value, 1) = "'" Then .NumberFormat = "@" .Value = Mid(.Value, 2) End If End With Next myCell End Sub I created a .csv file that looked like this: '1234,'1234,'2345,'2345 '1234,'1234,'2345,'2345 '1234,'1234,'2345,'2345 '1234,'1234,'2345,'2345 '1234,'1234,'2345,'2345 '1234,'1234,'2345,'2345 ras wrote: When I prefix a number in a CSV with a single quote, the single quote appears in the cell. If I then select the cell, put my cursor in the edit bar and hit tab, it'll reinterpret the quote and treat the cell as text. Is there any way to write a macro that visits each cell and does this? (No, recording this into a macro does no good.) This seems to be a common problem- and no, treating it as a txt file and specifying all the formats is not a decent solution. I could write a perl script to do this (or presumably a Basic script), but that seems like a lot of work for a simple problem. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? | Excel Discussion (Misc queries) | |||
how to convert GETPIVOTDATA from excel 2000 to excel 2002... | Excel Worksheet Functions | |||
Difference in number of Excel NewsGroups | Excel Discussion (Misc queries) | |||
Excel should add numbers without leading punctuation | Excel Discussion (Misc queries) | |||
numbers and text in Excel to read as text keeping the leading zer. | Excel Discussion (Misc queries) |