stop a text field reverting to scientific notation

grapevine

Board Regular
Joined
May 23, 2007
Messages
208
I have a CSV file that is reworked with a macro so that the information can be read by a printing machine.

One of the columns contains a series of 12 digit barcodes that needs to be read as text.

Currently the number appears in scientific notation.
Problem -
If I convert directly to text, it still appears as scientific notation
I can convert it to a number so that all 12 digits appear but when I try and change the column to text it reverts to scientific notation.
I have tried inserting another column, making it text then copying and pasting the data in, but the new column reverts to number.

If I put a ' in front of the number it does stay as the proper number but this is not practicable as the file could easily be several hundred rows long and many files are processed on a daily basis. Is there any VBA which can convert the number to text but still retain the full 12 characters?
I am using Excel 2007, although the file is saved in 2003 compatibility mode.

Any help gratefully received.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Try changing the file extension from csv to txt. Then the Text Import Wizard should fire and you can choose the format of the column at Step 3.
 
Upvote 0
Many thanks for your suggestion, but unfortunately the file is already split by others who may or may not remember to make the column text.(we cannot control that end) The file is then stored on a system until it is ready to be used when it manipulated by the macro and the results fed into the print machine. There are several people who could run the macro.

I want the macro to ensure that the field is always correct regardless of how it is split. If a scientific notation slips in unnoticed the entire printing batch has to be redone causing unnecessary time and cost.

I need some code to incorporate into the macro to check this column and ensure it is showing all 12 characters and is a text field.

Many thanks
 
Upvote 0

Forum statistics

Threads
1,196,215
Messages
6,014,040
Members
441,801
Latest member
Aneurysm

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