Avatar of Frank Freese
Frank FreeseFlag for United States of America asked on

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?
Microsoft Excel

Avatar of undefined
Last Comment
Frank Freese

8/22/2022 - Mon
Gregory Miller

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?
byundt

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?
ASKER
Frank Freese

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
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
byundt

I apologize for duplicating your point, Technodweeb.
SOLUTION
Gregory Miller

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Gregory Miller

@byundt - No worries... =>
ASKER CERTIFIED SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
Frank Freese

byundt's format worked.
To the two of you I apologize for being rather vague.
Thank you both
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.