run time error 424: object required

countryfan_nt

Well-known Member
Joined
May 19, 2004
Messages
765
Hello friends, Hope all is well!

Stuck in the below code, I got run time error 424: object required. The following was highlighted:
If Target.Address = "$I$5" Then

Really and always appreciate your help in advance!

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Call CHANGE

End Sub

Code:
Sub CHANGE()

 Dim pt As PivotTable
 Dim Field As PivotField
 Dim NewCat As String
    
If Target.Address = "$I$5" Then
    
    If IsDateFormat(Target.NumberFormat) Then
        If Len(Target.Value) > 0 Then
            If IsDate(Target.Value) Then
                InitialDate = CDate(Target.Value)
            End If
        End If
        
        DT = ShowCalendar("Double Click on the selected date", InitialDate)
        
        If Not IsEmpty(DT) Then
            Target.Value = CDate(DT)
        End If
        
        Cancel = True
    End If
End If
 

If Target.Address = "$O$10" Then
'    If Intersect(Target, Me.Range("D11")) Is Nothing Then
            Call FIL1
    End If
End Sub
 
Last edited:

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
You're not passing Target to the procedure CHANGE, try replacing with following:
Rich (BB code):
Sub Change(ByRef Target As Range)

    Dim pt          As PivotTable
    Dim Field       As PivotField
    Dim InitialDate As Date
    
    Application.ScreenUpdating = False
    
    With Target
        Select Case .Address
            Case Is = "$I$5"
                If isdateformat(.NumberFormat) And Len(.Value) > 0 And IsDate(.Value) Then
                    InitialDate = CDate(.Value)
                    DT = showcalendar("Double Click on the selected date", InitialDate)
                    If Not istempty(DT) Then .Value = CDate(DT)
                End If
            
            Case Is = "$O$10"
                Call Fill
        End Select
    End With
        
    Application.ScreenUpdating = True
    
End Sub
 
Last edited:
Upvote 0
You need to change the worksheet event call to:
Rich (BB code):
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Call Change(Target)

End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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