ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Auto insert values? (https://www.excelbanter.com/excel-discussion-misc-queries/16706-auto-insert-values.html)

Rick

Auto insert values?
 
I am importing a .csv file and wish to have cells populate a default length
in width. If the cell doesnt take up the whole width, I would like to have
zeroes (or some other value) inserted at the beginning. Example: the cell
needs to be 8 characters, the number importing is only 4 and I wish to add 4
zeroes in front such as 00001234 automatically. How would I accomplish this?

Dave Peterson

Can you just format that column to show the leading 0's?

Select the column
format|Cells|Number tab
custom
00000000

If that's not enough, maybe you can use a helper column to show the leading 0's.

=text(a1,"00000000")
and drag down.

Then copy|paste special|values and delete the original column.

If I wanted this automatic, I'd record a macro when I did it the first time.
Then I could run that macro to open the .csv file and do the manipulation.



Rick wrote:

I am importing a .csv file and wish to have cells populate a default length
in width. If the cell doesnt take up the whole width, I would like to have
zeroes (or some other value) inserted at the beginning. Example: the cell
needs to be 8 characters, the number importing is only 4 and I wish to add 4
zeroes in front such as 00001234 automatically. How would I accomplish this?


--

Dave Peterson

Rick

Dave,

You have answered a couple of my requests! Thank you for participating.
Your information is very helpful!

Rick

"Dave Peterson" wrote:

Can you just format that column to show the leading 0's?

Select the column
format|Cells|Number tab
custom
00000000

If that's not enough, maybe you can use a helper column to show the leading 0's.

=text(a1,"00000000")
and drag down.

Then copy|paste special|values and delete the original column.

If I wanted this automatic, I'd record a macro when I did it the first time.
Then I could run that macro to open the .csv file and do the manipulation.



Rick wrote:

I am importing a .csv file and wish to have cells populate a default length
in width. If the cell doesnt take up the whole width, I would like to have
zeroes (or some other value) inserted at the beginning. Example: the cell
needs to be 8 characters, the number importing is only 4 and I wish to add 4
zeroes in front such as 00001234 automatically. How would I accomplish this?


--

Dave Peterson



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

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