Error Code 424 -- Object Required in line "Match"

Kitty Lee

New Member
Joined
Sep 10, 2017
Messages
2
Code:
Sub ToSummary()
    
    Dim wsM As Worksheet
    Set wsM = Sheets("Billings")
    Dim lrSort As Long
    Dim wsS As Worksheet
    Set wsS = Sheets("Summary")
    Dim Z As Integer
    Z = 10
    
    lrSort = wsM.Range("C65536").End(xlUp).Row


   ' On Error Resume Next
    For X = 2 To lrSort
        Y = Empty
        Y = Applicaion.WorksheetFunction.Match(wsM.Cells(X, 1), wsS.Cells(2, 1), 0)
        If Application.IsNumber(Y) Then
           wsM.Cells(X, 1).Resize(1, 7).Copy Destination:=wsS.Cells(Z, 1)
           Z = Z + 1
        End If
    Next X
    
End Sub

I try to copy worksheet wsM to worksheet wsS when wsM.Cells(x,1) match with wsS.Cells(2,1).
Debugger told me 424 error message -- Object required in line "Y=Application.WorksheetFunction.Match(wsM.Cells(X,1), wsS.Cells(2,1), 0)".

My wsM sheet is:
Item Location Qty
A Warehouse1 10
A Warehouse2 20
B Warehouse1 20
B Warehouse2 30

My wsS sheet is:
Item
A
[TABLE="width: 240"]
<colgroup><col span="2"><col></colgroup><tbody>[TR]
[TD]
I already checked the value of wsM.Cells(X,1) and wsS.Cells(2,1) = A when I step into my code.[/TD]
[TD][/TD]
[TD="align: right"]

[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited by a moderator:

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Your code actually says Applicaion and not Application.

I'm not really clear why you are using Match rather than a simple equality test?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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