Custom format of numbers

Huffy

New Member
Joined
Dec 10, 2009
Messages
2
Hi all... and many thanks to a lot of the posts I've been through already to help me out!

What I'm looking to do now in my macro is a custom format of a group of cells to display 5 numbers. Example output would be:

10141
04039
00583
92584
35412
99919
00098

The zeros must be displayed. The cells are formatted as numbers, but of course, the zeros that begin the numbers disappear.
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Welcome to the Board!

If you format as Text instead of Number, the leading zeroes will not be dropped. Formatting the cells as Text before populating should do the trick, as long as your code isn't trying to insert a number that has already dropped the leading zeroes.

If so, you can convert it in VBA using:
FORMAT(Value,"00000")
 
Upvote 0

Forum statistics

Threads
1,215,779
Messages
6,126,848
Members
449,343
Latest member
DEWS2031

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