Format a cell to auto calculate a input value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How does one format a cell to automatically multiply a input value by a fixed number and return the product in the same cell? Can this be done in Excel?
 
Hi Tom
this can only be done with an event procedure in VBA. Try the following
macro (it hast to go in your worksheet module):

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.count > 1 Then Exit Sub
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub
on error goto errhandler
If Target.Value <> "" Then
application.enableevents = false
target.value = target.value * 10
End If
errhandler:
application.enableevents = True
End Sub

This multiplies the value entered in A1 with 10. To learn more about
event macros have a look at
http://www.cpearson.com/excel/events.htm

Instead of using this kind of macros you may consider simply using two
cells:
- enter your value in A1
- enter the formula =A1*10 in cell B1

Result: Easier to use and does not require macros
 
I don't think so, unless you want to edit the cell every
time. Can't you have the input value and the fixed
values in two different cells?
Merlin
-----Original Message-----
How does one format a cell to automatically multiply a
input value by a fixed number and return the product in
the same cell? Can this be done in Excel?
 
Back
Top