Convert input cell into metric tons

M

mkerstei

Hey, I need a solution and can't quite figure it out myself. I was
hoping for some good ideas.

I have a cell that people will be inputing data into. This data is
requested in lbs. I need to convert it to metric tons by dividing the
input by 2204.6. I think its a formatting issue, but I don't know how
to custom format it. An example is below.

Example:
They input 10000 in cell C8 as pounds.
As soon as data is entered into C8, it is divided by 2204.6 and that is
what is left displayed in C8.

Does anyone know if this is possible, and what the best practice is for
doing so? Thanks.


Mike
 
B

BenjieLop

mkerstei said:
Hey, I need a solution and can't quite figure it out myself. I was
hoping for some good ideas.

I have a cell that people will be inputing data into. This data is
requested in lbs. I need to convert it to metric tons by dividing the
input by 2204.6. I think its a formatting issue, but I don't know how
to custom format it. An example is below.

Example:
They input 10000 in cell C8 as pounds.
As soon as data is entered into C8, it is divided by 2204.6 and that is
what is left displayed in C8.

Does anyone know if this is possible, and what the best practice is for
doing so? Thanks.

Mike

I don't think what you want to accomplish is possible (as far as I
know). What you will enter in cell C8 is what will appear in C8 (if you
enter 10000, it will appear as 10000 all the time).

Perhaps, what you can do is enter the following formula

=C8/2204.62

in, say, cell D8:

Regards.
 
G

Gord Dibben

Mike

You need event code.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("C8")) Is Nothing Then Exit Sub
On Error GoTo CleanUp
Application.EnableEvents = False
With Target
If .Value <> "" Then
.Value = .Value / 2204.6
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub

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

Copy/paste the above event code into that sheet module.

When you enter a number in C8 it will be divided by 2204.6


Gord Dibben MS Excel MVP
 

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