Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default about the dot standing alone

Why not format as General?
--
David Biddulph

"santhagr" wrote in message
oups.com...
i don't know how to make a format in order to place the dot and the
digits that follow if there are any and if there aren't NOT to have a
dot standing there alone.

so far i put the special format: ### ### ###.## but there is a dot
alone
and if i put : ### ### ###_0_0 it rounds the number up

do u have any idea??



  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default about the dot standing alone

i don't know how to make a format in order to place the dot and the
digits that follow if there are any and if there aren't NOT to have a
dot standing there alone.

so far i put the special format: ### ### ###.## but there is a dot
alone
and if i put : ### ### ###_0_0 it rounds the number up

do u have any idea??

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default about the dot standing alone

i want to have the spaces also: 1 200 400 not 1200400

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default about the dot standing alone

You won't be able to do this with numberformatting alone.

If the values are typed in (not the results of a formula), you could use an
event macro. Rightclick on the worksheet tab that should have this behavior.
Select view code and paste this in the code window:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Cells.Count 1 Then Exit Sub
If Intersect(.Cells, Me.Range("a:a")) Is Nothing Then
Exit Sub
End If

If Int(.Value) = .Value Then
'no decimal places
.NumberFormat = "### ### ###"
'or maybe
'.NumberFormat = "### ### ###_._0_0"
Else
.NumberFormat = "### ### ###.##"
'or maybe
'.NumberFormat = "### ### ###.00"
End If
End With
End Sub

Then back to excel to test it out. I adjusted the cells in column A. Change it
to what you want. If the values change as the result of a formula
recalculation, a different event (with small differences in code) could be used.

The 'or maybe versions may be nice if you want the (assumed) decimal places to
align.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

You can read more about events at:
Chip Pearson's site:
http://www.cpearson.com/excel/events.htm

David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/event.htm

santhagr wrote:

i don't know how to make a format in order to place the dot and the
digits that follow if there are any and if there aren't NOT to have a
dot standing there alone.

so far i put the special format: ### ### ###.## but there is a dot
alone
and if i put : ### ### ###_0_0 it rounds the number up

do u have any idea??


--

Dave Peterson
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
assigning class standing based on grade Christopher Excel Discussion (Misc queries) 3 November 12th 06 09:06 PM


All times are GMT +1. The time now is 09:28 PM.

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

About Us

"It's about Microsoft Excel"