5 pts.
 Data entry and calculations in the same cell
I have an excel template and would like to allow the user to input their date in one of two ranges and have the other range calculated automatically based on a formula to use in each cell This means that the formula needs to be outside the cells in the two ranges as they are both used for date entry For example Enter pounds The first range A1:M1 Then data would be converted to Kilos in Range A2:M2 Or , Enter Kilos in range A2:M2 Then data would be converted to Pounds in Range A1:M1 thank you so much

Software/Hardware used:
excel
ASKED: April 29, 2010  5:30 PM
UPDATED: April 29, 2010  7:14 PM

Answer Wiki:
Some VBA code like this should work: <pre>Private Sub Worksheet_Change(ByVal Target As Range) Dim newValue As Double Dim newCell As Range If Target.Row < 3 Then If Target.Row = 1 Then Set newCell = Cells(2, Target.Column) newValue = Target.Value / 2.205 ElseIf Target.Row = 2 Then Set newCell = Cells(1, Target.Column) newValue = Target.Value * 2.205 End If If newCell.Value <> newValue Then newCell.Value = newValue End If End If End Sub</pre> -CarlosDL
Last Wiki Answer Submitted:  April 29, 2010  7:14 pm  by  carlosdl   63,580 pts.
All Answer Wiki Contributors:  carlosdl   63,580 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _