How to type 123 & have it print 1.23 without using Options..edit?

G

Guest

I want to format a range of cells so that it automatically places the decimal
point as if it were money...i.e. type 123 & have it print 1.23. I want to do
this without using the Options....edit which does it for the whole
spreadsheet, thus not allowing different types of number formats elsewhere in
the spreadsheet. I don't have any negative numbers, and I feel the answer is
in the custom number format, but I haven't been able to figure how it works.
 
G

Guest

This Custom Format will do what you're asking:

0\.00

However, be careful, because this ONLY affects the display, and not the
number that is stored. So, 123 would appear as 1.23, but would still be
treated as One-Hundred-Twenty-Three. If you need to use these cells for
calculations, then first divide them by 100.

HTH,
Elkar
 
G

Gord Dibben

Event code for a range can do what you want.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo enditall
Application.EnableEvents = False
If Not Application.Intersect(Range("A1:A30"), Target) Is Nothing Then
n = Target.Row
If Excel.Range("A" & n).Value <> "" Then
Excel.Range("A" & n).Value = Excel.Range("A" & n).Value / 100
End If
End If
enditall:
Application.EnableEvents = True
End Sub

Right-click on the sheet tab and "View Code"

Copy/paste the code into that sheet module.


Gord Dibben MS Excel MVP

On Thu, 12 Oct 2006 10:14:02 -0700, Jim Wyns <Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top