VBA If Match Then

hcparsons12

New Member
Joined
Jul 1, 2021
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Hey everyone,

Keep in mind that I am very new to VBA, but not Excel. I've been attempting to learn VBA and apply it to my projects only over the past week or so. Currently, I am trying to write a code that searches across the table headers in a "Per Game" Sheet for a match to a changing reference in the "Player Search" Sheet. I have gotten the loops to work in that the macro runs through the correct rows or columns in each Sheet until it finds a match, but I cannot figure out how to tell the macro what to do when it finds said match. When it finds the match in the "Per Game" Sheet, I need it to take the average of the 540 rows beneath it. Then, reset and move on to the next match and do the same until reaching the bottom of "J5:J24" range, where the value of the averages go, in the "Player Search" Sheet. I'll attach a picture of my code. When I run it, I usually get a "424" error for object required.
 

Attachments

  • Code.PNG
    Code.PNG
    17.6 KB · Views: 27

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.

Forum statistics

Threads
1,214,625
Messages
6,120,598
Members
448,973
Latest member
ksonnia

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