Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / April 2008

Tip: Looking for answers? Try searching our database.

How to programmatically access Number Format String in the Format

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
xiao - 15 Apr 2008 21:59 GMT
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,
JLGWhiz - 15 Apr 2008 23:03 GMT
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.

> Hi,
> We know that Excel allows us to format a cell in the “Format Cells Dialog”.
[quoted text clipped - 4 lines]
> the Format Cells Dialog without selecting each format manually?  
> Thanks,
xiao - 16 Apr 2008 17:46 GMT
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.

> 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
[quoted text clipped - 11 lines]
> > the Format Cells Dialog without selecting each format manually?  
> > Thanks,
JLGWhiz - 16 Apr 2008 20:18 GMT
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.

> JLGWhiz,
> Thanks a lot for your reply.
[quoted text clipped - 20 lines]
> > > the Format Cells Dialog without selecting each format manually?  
> > > Thanks,
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.