PDA

View Full Version : Controlling the number formats in a file



musicgold
07-13-2012, 06:21 AM
Hi,

I am sick and tired of fixing exotic number formats created by other people.

Is there a way to control the number formats allowed in an Excel file?

Thanks.

CodeNinja
07-13-2012, 07:32 AM
Musicgold,
If you just want one numberformat across all cells, easy way would be on workbook open to format the cells the way you want. If not, you could certainly break it down to smaller ranges and make sure they are formatted that way each time the workbook is opened, or even just fix them all when you run a macro yourself with 1 click...

Private Sub Workbook_Open()
Sheet1.Cells.NumberFormat = "0.00"
End Sub

musicgold
07-13-2012, 10:17 AM
Thanks CodeNinja.

That would be too restrictive. What I would ideally like to do is to be able allow only, say, five number formats in the sheet. The user has to choose his number formats from those five. Is it possible?