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

I already checked the value of wsM.Cells(X,1) and wsS.Cells(2,1) = A when I step into my code.



<colgroup><col span="2"><col></colgroup><tbody>
</tbody>
 
Last edited by a moderator:

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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,213,534
Messages
6,114,184
Members
448,554
Latest member
Gleisner2

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