Why do I get object required error here?

vbaNumpty

Board Regular
Joined
Apr 20, 2021
Messages
171
Office Version
  1. 365
Platform
  1. Windows
Trying to delete some data with a macro but I get a 424 object required error when I get to the deletion. Code is as follows:

VBA Code:
For j = 1 To i
    
        If myArray(j, 9) = "Pick Up" Or myArray(j, 9) = "Pick Up - NEEDS REVIEW" Then
           
            myArray(j, 1).Resize(0, 12).Delete shift:=xlUp
        
        End If
        
    Next j

myArray(j, 1).Resize(0, 12).Delete shift:=xlUp is where I get the error.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
You cannot resize or delete values in an array like that.
What exactly are you trying to do?
 
Upvote 0
You cannot resize or delete values in an array like that.
What exactly are you trying to do?
I am trying to filter and advanced filter list, a double filtering if you will.

I first have an advanced filter, I then copy those results to a new location to delete the contents I don't want.
 
Upvote 0
That does not tell me very much, but if you are already using the advanced filter, why not just adapt it to only return the results you want?
 
Upvote 0
That does not tell me very much, but if you are already using the advanced filter, why not just adapt it to only return the results you want?
I am filtering based on dates, I then want to filter that list based on delivery status. I will just change how I organize the data and delete the rows then I guess. thanks for teaching me about not being able to manipulate arrays in the fashion I wanted.
 
Upvote 0
Are you using the inbuilt Advanced filter? If so why not just filter both on date & status, then copy the data?
 
Upvote 0
Solution
Are you using the inbuilt Advanced filter? If so why not just filter both on date & status, then copy the data?
You can advanced filter on more than one criteria? How would you do that? I am using the following:

VBA Code:
ordSht.Range("S1").Value = "Ship Date"
    ordSht.Range("S2").Value = Evaluate("=today()")
    
    ordSht.Range("A2:L1048576").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _
    ordSht.Range("$S$1:$S$2"), CopyToRange:=ordSht.Range("$U$1:$AF$1"), Unique:=False
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,315
Members
452,634
Latest member
cpostell

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