Thread: NumberFormat
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default NumberFormat

Custom format A1:E1 as 0000 won't help?


Gord Dibben MS Excel MVP


On Wed, 20 May 2009 12:41:05 -0700, danpt
wrote:

Range("A1:E3") contains 1 to 4 digits arithmetic numbers.
I want to format the range in "0000" format and still retain its
arithmetical properties.
This macro will duplicate the range in that format.
Can Range("A1:E1") be formatted "0000" in its own location?

Sub format()
Range("A5") = "=TEXT(A1,""0000"")"
Range("A5").AutoFill Destination:=Range("A5:A7"), Type:=xlFillDefault
Range("A5:A7").AutoFill Destination:=Range("A5:E7"), Type:=xlFillDefault
End Sub