PC Review


Reply
Thread Tools Rate Thread

Default Formats

 
 
meh2030@gmail.com
Guest
Posts: n/a
 
      20th Sep 2007
Is there a way to find out the default number formats for Excel? For
example, if you open the "Format Cells" dialog box (Menu Bar: Format /
Cells, or Ctrl+1), click the "Number" page, and select "Date", the
"Type:" box populates with a number of options. I'm asking if there
is a way to programmatically discover what these defaults are.

The reason I want to know this is because I received an Excel file
this past week that had so many Custom formats that the file wouldn't
let me make formatting changes. I've never seen this error before,
but I've also never seen so many custom formats before. Ultimately, I
would like to delete the non-default formats, and maintain the default
custom formats without accidentially deleting them (if that's even
possible). (Hopefully this makes sense).

My thought process is below. I can do the comparision part, but I
don't know how to find out what the default formats are. Any help is
greatly appreciated. Thanks in advance.

Matt

Sub test_Format()

Dim n As Variant

'place default formats into an array, e.g. formatAry()

For Each n In Selection.Cells
' Debug.Print n.Address; ": "; n.NumberFormat
'compare formatAry(i) to n.NumberFormat
'If n.NumberForat <> formatAry(i) Then
'n.DeleteNumberFormat x
Next

End Sub

 
Reply With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      20th Sep 2007

If you select "Custom" at the bottom of the list then the custom formats
appear at the bottom of the "Type" list.
The custom formats are the only ones that can be deleted - by
clicking the "Delete" button. That button is grayed out if a
built-in format is selected.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



<(E-Mail Removed)>
wrote in message
Is there a way to find out the default number formats for Excel? For
example, if you open the "Format Cells" dialog box (Menu Bar: Format /
Cells, or Ctrl+1), click the "Number" page, and select "Date", the
"Type:" box populates with a number of options. I'm asking if there
is a way to programmatically discover what these defaults are.

The reason I want to know this is because I received an Excel file
this past week that had so many Custom formats that the file wouldn't
let me make formatting changes. I've never seen this error before,
but I've also never seen so many custom formats before. Ultimately, I
would like to delete the non-default formats, and maintain the default
custom formats without accidentially deleting them (if that's even
possible). (Hopefully this makes sense).

My thought process is below. I can do the comparision part, but I
don't know how to find out what the default formats are. Any help is
greatly appreciated. Thanks in advance.

Matt

Sub test_Format()

Dim n As Variant

'place default formats into an array, e.g. formatAry()

For Each n In Selection.Cells
' Debug.Print n.Address; ": "; n.NumberFormat
'compare formatAry(i) to n.NumberFormat
'If n.NumberForat <> formatAry(i) Then
'n.DeleteNumberFormat x
Next

End Sub

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting default formats Dave Microsoft Excel Misc 4 27th Jan 2008 05:05 PM
Default Cell Formats =?Utf-8?B?QWxpc3RhaXJlIEdyZWVu?= Microsoft Excel Misc 2 18th Jun 2007 02:47 PM
Default date formats =?Utf-8?B?SiBGdWx0eg==?= Microsoft Excel New Users 6 27th Apr 2005 09:53 PM
Default column formats =?Utf-8?B?Wm9ya2ZvYg==?= Microsoft Excel Misc 5 4th Mar 2005 01:23 AM
Default Folder Formats =?Utf-8?B?RXJuaWU=?= Microsoft Outlook Discussion 2 9th Oct 2004 02:29 PM


Features
 

Advertising
 

Newsgroups
 


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