Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inputbox problem.

Status
Not open for further replies.

gjsala

Technical User
Feb 20, 2003
107
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top