Getting the right numberformat

I've been trying to set the numberformat to display a specific format with VBA:
Selection.NumberFormat = "##0"

Open in new window

That did not work not has other formats I've tried.

Here's my objective

What is the correct NumberFormat to meet my objective?
Frank FreeseAsked:
Who is Participating?
byundtConnect With a Mentor Commented:
If you don't want commas, leading zeros or decimal points, how about:
Selection.NumberFormat = "#;-#;0;@"
Gregory MillerGeneral ManagerCommented:
Not certain I follow...
Can you show the number you have in the cell and the number you want it to be displayed like. i.e.
123 - should become - 1230
123 - should become - 120
something else?
Your code is working for me, so I obviously am not understanding your question.

Could you please post both cell contents and how you want them displayed?
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Frank FreeseAuthor Commented:
This is the type of format I need to show.
A1 = 123
A2 = 1230
A3 = 0
(All numbers are integers)

Sometimes I get nothing when the value is 0
Sometime I get 001230 when the value is 1230
I apologize for duplicating your point, Technodweeb.
Gregory MillerConnect With a Mentor General ManagerCommented:
Sorry to be dense but you are not clear on what the raw number in the cell is and how you want it to be displayed.
Gregory MillerGeneral ManagerCommented:
@byundt - No worries... =>
Frank FreeseAuthor Commented:
byundt's format worked.
To the two of you I apologize for being rather vague.
Thank you both
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.