Code for updating values from Input boxes
Posted by Gloria on March 21, 2001 5:42 PM
Please, somebody... I need help changing the following macro, so that if I change the value on the spreadsheet (MyRange1 and MyRange2), the equation will also update. I found most of this code from other questions here, but don't know how to make the changes. Thanks in advance.
Dim MyRange1 As Range, MyRange2 As Range
On Error Resume Next
Set MyRange1 = Application.InputBox _
(Prompt:="Select first cell", Type:=8)
If MyRange1 Is Nothing Then Exit Sub
Set MyRange2 = Application.InputBox _
(Prompt:="Select second cell", Type:=8)
If MyRange2 Is Nothing Then Exit Sub
MsgBox "TOTAL =(" & MyRange1.Value & ") + (" & MyRange2.Value & ")"
'Display message box.
ActiveCell.FormulaR1C1 = ("TOTAL =(" & MyRange1.Value & ")+ (" & MyRange2.Value & ")")