I have the following code and I keep getting a type mismatch error and method range of object, global failed. Any help would be appreciated.
Sub inputA()
Dim ans As String, inp As String, quest As String, Answer As Integer
'Selecting the cell to change.
ans = Application.InputBox("Type the cell you wish to change. For example: C23.", Answer)
If ans = False Then
MsgBox ("Please type in a cell to change!"
, vbCritical, "Warning"
Call inputA
End If
If ans = "" Then
MsgBox ("Please type in a cell to change!"
, vbCritical, "Warning"
Call inputA
End If
inp = InputBox("Type in the new number.", Answer)
If inp = "" Then
MsgBox ("Please type in a number!"
, vbCritical, "Warning"
Call inputA
End If
range(ans).Value = inp
'Asking to change more cells.
quest = MsgBox("Do you have more samples or markers to change?", vbYesNo, "Next step"
If quest = vbYes Then
Call inputA
End If
If quest = vbNo Then
Call Calculate
End If
End Sub
Sub inputA()
Dim ans As String, inp As String, quest As String, Answer As Integer
'Selecting the cell to change.
ans = Application.InputBox("Type the cell you wish to change. For example: C23.", Answer)
If ans = False Then
MsgBox ("Please type in a cell to change!"
Call inputA
End If
If ans = "" Then
MsgBox ("Please type in a cell to change!"
Call inputA
End If
inp = InputBox("Type in the new number.", Answer)
If inp = "" Then
MsgBox ("Please type in a number!"
Call inputA
End If
range(ans).Value = inp
'Asking to change more cells.
quest = MsgBox("Do you have more samples or markers to change?", vbYesNo, "Next step"
If quest = vbYes Then
Call inputA
End If
If quest = vbNo Then
Call Calculate
End If
End Sub