#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default NumberFormat

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 793
Default NumberFormat

Yes. Select the range A1:E3
Choose Format-Cells
Select CUSTOM
and enter the format as
0000

"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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default NumberFormat

While not recognized as number by the ISNUMBER function, your TEXT function
reutrns a value that is capable of being used in arithmetic.

However, if you just want to format the cells to give a certain display, it
would probably be easier to go to Format Cells - Number, custom
and then input
0000
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"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

  #4   Report Post  
Posted to microsoft.public.excel.misc
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
numberformat? Jack Sons Excel Discussion (Misc queries) 3 September 4th 07 03:44 PM
NumberFormat? alex Excel Worksheet Functions 3 March 1st 07 09:12 PM
Format numberformat Single BenCoo Excel Worksheet Functions 1 March 17th 06 06:17 PM
using cells.numberformat maxzsim Excel Worksheet Functions 2 May 6th 05 10:41 AM
Setting NumberFormat within a VBA Module Dominic Olivastro Excel Discussion (Misc queries) 3 April 20th 05 12:10 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"