Posting results in matched column, accordingly VBA

rjackson

New Member
Joined
Apr 26, 2011
Messages
6
This is the code I borrowed from another site that works fine but I want to post my results in column F on sheet1 where A from sheet1 matches A from sheet2. Any help would be appreciated. Thanks,

Sub FindMatches()
Dim Sht1Rng As Range
Dim Sht2Rng As Range
Set Sht1Rng = Worksheets("Sheet1").Range("A1", Worksheets("Sheet1").Range("A65536").End(xlUp))
Set Sht2Rng = Worksheets("Sheet2").Range("A1", Worksheets("Sheet2").Range("A65536").End(xlUp))
For Each c In Sht2Rng
Set d = Sht2Rng.Find(c.Value, LookIn:=xlValues)
If Not d Is Nothing Then
Worksheets("Sheet1").Range("F65536").End(xlUp).Offset(1, 0).Value = c.Value
Worksheets("Sheet1").Range("F65536").End(xlUp).Offset(0, 1).Value = c.Offset(0, 1).Value
Set d = Nothing
End If
Next c
End Sub
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
basically i have one set of data with 22000 records and one set with 9000 records and i want to post a matched field from the set with 9000 records to the set with 22000 records...thanks
 
Upvote 0

Forum statistics

Threads
1,224,565
Messages
6,179,549
Members
452,927
Latest member
rows and columns

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