Excel VBA Help Match, and paste value based on rows values.

jacob123588

New Member
Joined
Jul 30, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Good afternoon,

I have a performance tracker that I want to use for my team. On the "Coaching Tracker" sheet, I list User ID's from "C9:C2000". I want to lookup the userID for each row, and find them on "Last Week Performance" sheet. If the row's User ID is found, I want to copy the performance on the "Last Week Performance" sheet's Row B, to the corresponding row on the Coaching Tracker Sheet". I also want it to paste on the next empty cell to the right. I will be running this document every monday and pulling data for previous week end.

Let me know if this makes sense.

1659208406685.png

1659208448274.png
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi and welcome to MrExcel!

Try this:
VBA Code:
Sub MatchId()
  Dim f As Range
  Dim i As Long, lc As Long
  
  With Sheets("Coaching Tracker")
    lc = .Cells(9, Columns.Count).End(1).Column + 1
    For i = 9 To .Range("C" & Rows.Count).End(3).Row
      Set f = Sheets("Last Week Performance").Range("A:A").Find(.Range("C" & i).Value, , xlValues, xlWhole, , , False)
      If Not f Is Nothing Then
        .Cells(i, lc).Value = f.Offset(, 1).Value
      End If
    Next
  End With
End Sub

----------------
NOTE XL2BB:
For the future, it would help greatly if you could give us the sample data in a form that we can copy to test with, rather that a picture.
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in
Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0

Forum statistics

Threads
1,214,795
Messages
6,121,624
Members
449,041
Latest member
Postman24

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