seventy9mph
Board Regular
- Joined
- Apr 16, 2009
- Messages
- 72
Run-Time Error '424'
"Object Required"
I keep getting this error on the If Target.Count > 1 line.
Basically, if a few conditions are met, then a message box pops up and forces the user to input a number.
here is the code
any help would be great!!!!
thanks as always everyone!
"Object Required"
I keep getting this error on the If Target.Count > 1 line.
Basically, if a few conditions are met, then a message box pops up and forces the user to input a number.
here is the code
Code:
Sub trial()
Dim Station_2 As Variant
Dim VCLength_2 As Variant
If Range("$I$3") = "VC" Then
If Range("$I$2") = "GB" Then
If Target.Count > 1 Then Exit Sub
ActiveSheet.Unprotect ("password")
Application.EnableEvents = False '<-- Stops the code re-triggering
Select Case Target.Address
Case "$J$2", "$F$4", "$F$6"
If Range("$J$2") = "OVERLAP" Then
Do
Station_2 = InputBox("Your GB STATION overlaps into previous Vertical Curve. Try another Station")
If Station_2 = "" Or Not (IsNumeric(Station_2)) Then _
MsgBox "TRY AGAIN"
Loop Until IsNumeric(Station_2) And Station_2 <> ""
Range("F4") = Station_2
End If
Case Else:
End Select
Application.EnableEvents = True '<-- Turn 'Events' back on
ActiveSheet.Protect ("password")
ElseIf Range("$I$2") = "VC" Then
If Target.Count > 1 Then Exit Sub
ActiveSheet.Unprotect ("password")
Application.EnableEvents = False '<-- Stops the code re-triggering
Select Case Target.Address
Case "$J$2", "$F$4", "$F$6"
If Range("$J$2") = "OVERLAP" Then
Do
VCLength_2 = InputBox("Your VC LENGTH overlaps into previous Vertical Curve. Try another Length")
If VCLength_2 = "" Or Not (IsNumeric(VCLength_2)) Then _
MsgBox "TRY AGAIN"
Loop Until IsNumeric(VCLength_2) And VCLength_2 <> ""
Range("F6") = VCLength_2
End If
Case Else:
End Select
Application.EnableEvents = True '<-- Turn 'Events' back on
ActiveSheet.Protect ("password")
End If
End If
End Sub
any help would be great!!!!
thanks as always everyone!