Inserting spaces before payroll no.

Riaang

Board Regular
Joined
Aug 29, 2002
Messages
146
Hi, I have in column A a list of payroll numbers of different lenghts and also some starting with numeric and others with alpha letters. My problem is that the column with must be 7 digits long and if the payroll number is only 3 or 4 etc. I want a macro to fill up the front of the payroll number with spaces so that if it is saved as a text file all the payroll numbers will be in line to the left.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Riaang

Board Regular
Joined
Aug 29, 2002
Messages
146
Hi, I know the text must be left aligned but as soon as you have payroll starting with numerics and alphabetic letters in the same list it opens one space at the end of the payrolls starting with alpha leters when saving it in text format. If I insert the spaces in front it solves the problem. So I need a macro that will fill the payrolls with spaces in front so it will be in line when saving it in text form.
 

Forum statistics

Threads
1,147,822
Messages
5,743,400
Members
423,792
Latest member
travisds

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
Top