A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

NumberFormat



 
 
Thread Tools Display Modes
  #1  
Old May 20th, 2009, 08:41 PM posted to microsoft.public.excel.misc
danpt
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  
Old May 20th, 2009, 09:09 PM posted to microsoft.public.excel.misc
Sheeloo
external usenet poster
 
Posts: 797
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  
Old May 20th, 2009, 09:14 PM posted to microsoft.public.excel.misc
Luke M
external usenet poster
 
Posts: 2,672
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  
Old May 20th, 2009, 10:55 PM posted to microsoft.public.excel.misc
Gord Dibben
external usenet poster
 
Posts: 20,252
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


 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:10 AM.


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