VBA Alternative Match

Julmust Jaeger

New Member
Joined
Jul 20, 2022
Messages
20
Office Version
  1. 2016
Platform
  1. Windows
Hello,

This might be more conceptual question, but example code is appreciated, but I have a formula in a cell (AH2) that I use and then autofill the rest of the column with.

Excel Formula:
=NOT(ISERROR(MATCH(L2,Canceled!A:A,0)))

How would one do something similar using VBA?

Really, I all I conceptually would like to do is in some more efficient VBA way just check the values in L2 (a user number) and check if that is found in the other worksheet (called Canceled).

There are 361,216 rows (and 26 columns), so any efficient solutions are especially appreciated (I'm finding the formula quite slow and I am trying to get a better grasp of how to use VBA).

Cheers!
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
In VBA, you could put the values in each sheet into separate arrays, and then undertake the comparison in memory - that would conceivably be alot quicker. That's one option. I'm not at my computer at the moment to give an example, but can do so later later.
 
Upvote 0
Sorry, I just reread your post. Are you only checking one number against the list in the Cancelled sheet?
 
Upvote 0
For each row there is only one number (invoice number), basically this is step 1 in running an autofilter to remove all the canceled invoices (via this new column as some rows are the same invoice prior to the cancelation and I need to "catch" all of these).

There are many rows though that reflect an invoice number that has been canceled.

Good question though!
 
Upvote 0

Forum statistics

Threads
1,215,016
Messages
6,122,700
Members
449,092
Latest member
snoom82

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