Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Getting the right numberformat

Posted on 2013-12-28
8
Medium Priority
?
277 Views
Last Modified: 2013-12-28
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?
0
Comment
Question by:Frank Freese
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 12

Expert Comment

by:Gregory Miller
ID: 39744181
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
 
LVL 81

Expert Comment

by:byundt
ID: 39744185
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
 

Author Comment

by:Frank Freese
ID: 39744189
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 81

Expert Comment

by:byundt
ID: 39744190
I apologize for duplicating your point, Technodweeb.
0
 
LVL 12

Assisted Solution

by:Gregory Miller
Gregory Miller earned 400 total points
ID: 39744192
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
 
LVL 12

Expert Comment

by:Gregory Miller
ID: 39744194
@byundt - No worries... =>
0
 
LVL 81

Accepted Solution

by:
byundt earned 1600 total points
ID: 39744195
If you don't want commas, leading zeros or decimal points, how about:
Selection.NumberFormat = "#;-#;0;@"
0
 

Author Closing Comment

by:Frank Freese
ID: 39744206
byundt's format worked.
To the two of you I apologize for being rather vague.
Thank you both
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question