Run-Time Error '424' "Object Required"

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


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!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
If it is in a worksheet module, then
Change
Code:
Sub trial()
to
Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If not, try change Target to Selection
 
Upvote 0

Forum statistics

Threads
1,215,473
Messages
6,125,013
Members
449,204
Latest member
tungnmqn90

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top