Getting the right numberformat

Folks,
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
123
1230
0

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;@"
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
or
123 - should become - 120
or
something else?
0
 
byundtCommented:
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?
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
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
0
 
byundtCommented:
I apologize for duplicating your point, Technodweeb.
0
 
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.
0
 
Gregory MillerGeneral ManagerCommented:
@byundt - No worries... =>
0
 
Frank FreeseAuthor Commented:
byundt's format worked.
To the two of you I apologize for being rather vague.
Thank you both
0
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.