If Two Cells Match Insert Data Two Rows Down - Help

jbenfrancis1

New Member
Joined
Feb 22, 2022
Messages
11
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi, i have done a lot of searching and found some useful stuff but cannot piece it together to make it work. Here is my dilemma.

Sheet1 has data on it and the corresponding date.
Sheet2 has historical data on it with dates.

Sheet2 has column headers for each day so for example C6 is 2/21/2022, D6 is 2/20/2022 and so on all the way out to BJ6.

I am trying to write some code that will look at the date on Sheet1 and search for it on Sheet2 row 6. If they match, then add the data from Sheet1 2 rows below the date on Sheet2

This code allow it to search the range correctly and cycle through
VBA Code:
Dim b As Range
Set b = Sheets("Sheet2").Range("C6:BJ6")
For Each c In Sheets("Sheet1").Range("C2")
    If IsNumeric(Application.Match(c, b, 0)) Then
       'I don't know what to put here to say stop and insert data once match is found
        Exit Sub
        End If
    Next c
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,213,539
Messages
6,114,221
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