Greetings!
I am new to VBA so this might be a simple question.
I have an excel sheet where the cell D23 has a formula such that the integer value in D23 changes automatically once previous parameters are changed.
Anytime D23 value changes, an inputbox prompts for a value for cell D24. This value is entered and it duly appears in D24. However, the InputBox keeps popping up until you press 'Cancel'. Then it gives the following error: "Runtime error 13: Type mismatch".
The value entered in D24 via the inputbox is used in succeeding cells for further computation. Now I have noticed that the input box keeps reappearing only because the D24 value is called on in the next cells. If this value is not called on in any other cell then the InputBox does not loop.
Following is the code I have used:
Sub NewMu()
Dim NewMu1 As Integer
NewMu1 = InputBox("Insert New Mu w/ new self weight")
Range("D24").Value = NewMu1
End Sub
Private Sub Worksheet_Calculate()
Dim Xrg As Range
Set Xrg = Range("D23")
If Not Intersect(Xrg, Range("D23")) Is Nothing Then
NewMu
End If
End Sub
I would really appreciate if someone can propose a solution to ending this looping inputbox! Thanks!!
I am new to VBA so this might be a simple question.
I have an excel sheet where the cell D23 has a formula such that the integer value in D23 changes automatically once previous parameters are changed.
Anytime D23 value changes, an inputbox prompts for a value for cell D24. This value is entered and it duly appears in D24. However, the InputBox keeps popping up until you press 'Cancel'. Then it gives the following error: "Runtime error 13: Type mismatch".
The value entered in D24 via the inputbox is used in succeeding cells for further computation. Now I have noticed that the input box keeps reappearing only because the D24 value is called on in the next cells. If this value is not called on in any other cell then the InputBox does not loop.
Following is the code I have used:
Sub NewMu()
Dim NewMu1 As Integer
NewMu1 = InputBox("Insert New Mu w/ new self weight")
Range("D24").Value = NewMu1
End Sub
Private Sub Worksheet_Calculate()
Dim Xrg As Range
Set Xrg = Range("D23")
If Not Intersect(Xrg, Range("D23")) Is Nothing Then
NewMu
End If
End Sub
I would really appreciate if someone can propose a solution to ending this looping inputbox! Thanks!!