PDA

View Full Version : Format entire column



clhare
02-12-2008, 09:26 AM
I need a macro in Excel that will format column A (no matter how many rows) with Custom number format of "00000". How would I do that?

thomaspatton
02-12-2008, 10:57 AM
You could just select the Column Header (the A) which will select the entire row. Then, set the number format how you want in the options menu. This way, any number combination will show as "00000", while text will handle normally.

Bob Phillips
02-12-2008, 12:02 PM
or in VBA



Activesheet.Columns(5).NumberFormat = "00000"

clhare
02-13-2008, 06:13 AM
Thanks!

Another question.... is it possible to use a macro to apply the formatting for whatever cell or cells are selected?

Bob Phillips
02-13-2008, 06:23 AM
Selection.NumberFormat = "00000"