Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to programmatically access Number Format String in the Format

Hi,
We know that Excel allows us to format a cell in the Format Cells Dialog.
Then in the program, we can get the format string using
((Range)ActiveSheet.Cells[1, 1]).NumberFormat.
My question is:
Is there a way to programmatically access all the Number Format String in
the Format Cells Dialog without selecting each format manually?
Thanks,


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default How to programmatically access Number Format String in the Format

If you mean pull up some kind of menu, the answer is no. The dialogs method
is the only way to do that. However, you can use NumberFormat to set the
format to whatever format is available in the dialog box by simply specifying
the format name for certain ones such as "General", "Accounting", etc. Or you
can set cutom formats such as $##,##0; ( $##,##0) to get even dollars
displayed. NumberFormat is one of the more versatile of the VBA facilities.

"xiao" wrote:

Hi,
We know that Excel allows us to format a cell in the Format Cells Dialog.
Then in the program, we can get the format string using
((Range)ActiveSheet.Cells[1, 1]).NumberFormat.
My question is:
Is there a way to programmatically access all the Number Format String in
the Format Cells Dialog without selecting each format manually?
Thanks,


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to programmatically access Number Format String in the For

JLGWhiz,
Thanks a lot for your reply.
My question is:
can we list all the available NumberFormat in the Format Cells Dialog? In
other words, can we use a foreach() loop to display all the default
NumberFormat supported by Excel without openning the Format Cells Dialog? If
yes, could you show me some code to do so?
Thx.


"JLGWhiz" wrote:

If you mean pull up some kind of menu, the answer is no. The dialogs method
is the only way to do that. However, you can use NumberFormat to set the
format to whatever format is available in the dialog box by simply specifying
the format name for certain ones such as "General", "Accounting", etc. Or you
can set cutom formats such as $##,##0; ( $##,##0) to get even dollars
displayed. NumberFormat is one of the more versatile of the VBA facilities.

"xiao" wrote:

Hi,
We know that Excel allows us to format a cell in the Format Cells Dialog.
Then in the program, we can get the format string using
((Range)ActiveSheet.Cells[1, 1]).NumberFormat.
My question is:
Is there a way to programmatically access all the Number Format String in
the Format Cells Dialog without selecting each format manually?
Thanks,


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default How to programmatically access Number Format String in the For

No, you cannot access the NumberFormat options using a loop. The Dialogs box
is the only way that I know of to display and select options. Otherwise, you
have to explicitly assign the NumberFormat as a specific type.

"xiao" wrote:

JLGWhiz,
Thanks a lot for your reply.
My question is:
can we list all the available NumberFormat in the Format Cells Dialog? In
other words, can we use a foreach() loop to display all the default
NumberFormat supported by Excel without openning the Format Cells Dialog? If
yes, could you show me some code to do so?
Thx.


"JLGWhiz" wrote:

If you mean pull up some kind of menu, the answer is no. The dialogs method
is the only way to do that. However, you can use NumberFormat to set the
format to whatever format is available in the dialog box by simply specifying
the format name for certain ones such as "General", "Accounting", etc. Or you
can set cutom formats such as $##,##0; ( $##,##0) to get even dollars
displayed. NumberFormat is one of the more versatile of the VBA facilities.

"xiao" wrote:

Hi,
We know that Excel allows us to format a cell in the Format Cells Dialog.
Then in the program, we can get the format string using
((Range)ActiveSheet.Cells[1, 1]).NumberFormat.
My question is:
Is there a way to programmatically access all the Number Format String in
the Format Cells Dialog without selecting each format manually?
Thanks,


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting a string into a number format Albert Excel Discussion (Misc queries) 1 April 17th 08 10:18 AM
Programmatically Access to Symbol Dropdown in Format Cells Dialog Edmundo Excel Programming 2 January 8th 07 07:49 PM
change a string of numbers in to number format Debi Excel Worksheet Functions 1 December 7th 06 05:15 PM
[$-F800] in the number format string Serhiy Kravtsov Excel Discussion (Misc queries) 0 July 14th 06 02:07 PM
Color Codes: Localizing a number format string stitchy Excel Programming 1 August 19th 05 06:40 AM


All times are GMT +1. The time now is 07:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"