Copy data from sheet 1 to sheet 2 using matching names to determine the destination cell

Katie152

New Member
Joined
Nov 6, 2020
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a spreadsheet which uses the VBA coding on sheet 1 to create data entry on the next available row in sheet 2 for new starters.

I'd like to create another form on sheet 3 to populate additional columns in sheet 2 based on the name of the employee.

Could anyone please advise of a VBA code that would enter information from B1 in sheet 3 to column G in sheet 2, selecting the row when the values in Column A in Sheet 2 and Sheet 3 are the same.

Thank you
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
The data layout is not real clear, but you can try this. The code goes in a standard code module (module1)/
VBA Code:
Sub t()
Dim sh2 As Worksheet, sh3 As Worksheet, c As Range, fn As Range
Set sh2 = Sheets("Sheet2")
Set sh3 = Sheets("Sheet3")
    With sh3
        For Each c In .Range("A2", .Cells(Rows.Count, 1).End(xlUp))
            Set fn = sh2.Range("A:A").Find(c.Value, , xlValues, xlWhole)
                If Not fn Is Nothing Then
                    c.Offset(, 1).Copy fn.Offset(, 6)
                End If
        Next
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,259
Members
452,626
Latest member
huntinghunter

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