Hi
Is there a way to write an If statement (if condtion is not meet) to have both a MSGbox and a goto statement?
I would like to add this to the below if statement
'MsgBox "Check Value, Value out of Range Try Again", vbCritical
The below is what I have nowm it works with out the msgbox
Public Sub InputBoxMoveLeft()
Dim strMsg As String
Dim strInputBoxText As String
MsgBox "To Stop Macro Enter a Value of Zero Or Any Negative Value"
RESTART_Macro:
TC:
TC = Application.InputBox("Range is 24.8 - 26.8", "TC 224", "0")
If TC <= 0 Then Exit Sub
If TC < 24.8 Or TC > 26.8 Then GoTo TC
ActiveCell = TC 'Assign the value of the inputbox to a cell.
ActiveCell.Offset(0, 1).Select
strInputBoxText = Application.InputBox("Range is 27 to 29", "Dia 28", "0")
If strInputBoxText <= 0 Then Exit Sub
ActiveCell = strInputBoxText 'Assign the value of the inputbox to a cell.
ActiveCell.Offset(1, -2).Select
GoTo RESTART_Macro:
End Sub
Is there a way to write an If statement (if condtion is not meet) to have both a MSGbox and a goto statement?
I would like to add this to the below if statement
'MsgBox "Check Value, Value out of Range Try Again", vbCritical
The below is what I have nowm it works with out the msgbox
Public Sub InputBoxMoveLeft()
Dim strMsg As String
Dim strInputBoxText As String
MsgBox "To Stop Macro Enter a Value of Zero Or Any Negative Value"
RESTART_Macro:
TC:
TC = Application.InputBox("Range is 24.8 - 26.8", "TC 224", "0")
If TC <= 0 Then Exit Sub
If TC < 24.8 Or TC > 26.8 Then GoTo TC
ActiveCell = TC 'Assign the value of the inputbox to a cell.
ActiveCell.Offset(0, 1).Select
strInputBoxText = Application.InputBox("Range is 27 to 29", "Dia 28", "0")
If strInputBoxText <= 0 Then Exit Sub
ActiveCell = strInputBoxText 'Assign the value of the inputbox to a cell.
ActiveCell.Offset(1, -2).Select
GoTo RESTART_Macro:
End Sub