Excel -> CSV - how to keep leading 0's

dpnab

New Member
Joined
Apr 12, 2022
Messages
35
Office Version
  1. 365
Platform
  1. Windows
I'm saving (as values) an excel file into a CSV file but it's removing any leading 0's I have. I set the cell as text, didn't work. I set it as custom with the appropriate amount of 0's, same thing.

The cell is a formula (vlookup) so it returns 2 leading 0's but I can't get it to stay in the CSV file.

Any ideas on how to fix this?

Thanks!
 
The macro does not create a blank workbook, so when you open the workbook with the macro in it, and you click on View > Switch Windows, can you see other workbooks already open and if so what are they called.
 
Upvote 0

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
The macro does not create a blank workbook, so when you open the workbook with the macro in it, and you click on View > Switch Windows, can you see other workbooks already open and if so what are they called.
It doesn't show anything (it's greyed out). I do have a "personal macro workbook" that is always "unhidden". Would that be the cause?
 
Upvote 0
If its greyed out then you should not have any workbooks open and your are just seeing the Excel Toolbars & Menu with the working area as a grey area.

Everything works except it keeps a blank excel file open. Anyway to close that other than Application.Quit?
What is the name of the workbook that it keeps open ?
 
Upvote 0
PS: I don't like this and have it turned off.
When I open excel, it shows "Good Morning" and allows me to pick a new blank workbook, shows recent, pinned, shared with me, etc etc.

If you want to do the same try turning this off (Options > General)

1653053767151.png
 
Upvote 0
If its greyed out then you should not have any workbooks open and your are just seeing the Excel Toolbars & Menu with the working area as a grey area.


What is the name of the workbook that it keeps open ?
I tried on another machine and same issue (they don't have any other workbooks open/hidden/unhidden"). The workbook is hidden so I don't think that should be an issue. I could have add-ons running that I don't know about? I guess it's not the worst thing to just have to close the excel file manually.
PS: I don't like this and have it turned off.


If you want to do the same try turning this off (Options > General)

View attachment 65127
I made that change just in case but still the same.
 
Upvote 0
Maybe ask it as a new question. I just think quitting the application is bad practice. If someone else runs it and they end up losing a whole heap of work because they had multiple workbooks open, they are not going to be happy.
 
Upvote 0
Maybe ask it as a new question. I just think quitting the application is bad practice. If someone else runs it and they end up losing a whole heap of work because they had multiple workbooks open, they are not going to be happy.
Okay I'll try it as a new question. Thanks for your help, greatly appreciated!
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,196
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top