product function

G

Guest

This should be a very simple fix, I'm just not that schooled in excel and its
formulas. I'm tying to enter one number in a cell and it automatically
convert it to another in the same cell.

example: I'm going from gallons of fuel to weight (lbs). 1 Gal Fuel=6lbs.

it's a simple multiplication formula or it should be.

thanks,
js
 
G

Guest

Unless you use a macro there is no way for Excel to convert a cell to another
value in the same cell. You will have to enter the value in, say, cell A1
and have cell A2 contain the formula =A1*6. Whatever you enter in cell A1
will be multiplied by 6 and displayed in A2.

Again, if you want all this to be done in the same cell you need to use a
macro. If you need that let me know.

Hope this helps.

Bill Horton
 
J

JE McGimpsey

If you're trying to convert it in the same cell, you'll need to use an
event macro. You might consider separating the entry from the weight:

A1: <gallons>
B1: =A1 * 6

If you must do it in one cell, however, you can put this in your
worksheet code module (right-click the worksheet tab and choose View
Code):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count > 1 Then Exit Sub
If .Address(False, False) = "A1" Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
.Value = .Value * 6
Application.EnableEvents = True
End If
End If
End With
End Sub
 
G

Guest

thanks for the prompt reply. I understand what you are saying and I could do
that, however, what is this macro you are talking about? It sounds promising.
 
G

Guest

thanks for the help, I'll try that.

js

JE McGimpsey said:
If you're trying to convert it in the same cell, you'll need to use an
event macro. You might consider separating the entry from the weight:

A1: <gallons>
B1: =A1 * 6

If you must do it in one cell, however, you can put this in your
worksheet code module (right-click the worksheet tab and choose View
Code):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count > 1 Then Exit Sub
If .Address(False, False) = "A1" Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
.Value = .Value * 6
Application.EnableEvents = True
End If
End If
End With
End Sub
 
G

Guest

You don't need a macro for this. Enter 6 in any cell, copy that cell, then
select the entire range you have the gallon's in and "paste
special->multiply."
 
J

JE McGimpsey

You don't need a macro for this.

That would be true if you ignore the OP's use of "automatically
convert"...
 

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