Hi Starkey,
Try this:
Option Explicit
Sub Macro1()
'http://www.excelforum.com/excel-programming-vba-macros/859746-macro-to-find-sku-in-column-then-copy-data-in-row-and-paste-special-values.html?p=2928721
Dim wstSheet1 As Worksheet, _
wstSheet2 As Worksheet
Dim rngFoundCell As Range
Dim lngMatchRow1 As Long, _
lngMatchRow2 As Long
Application.ScreenUpdating = False
Set wstSheet1 = Sheets("Before")
Set wstSheet2 = Sheets("Data")
If Len(wstSheet1.Range("C2")) = 0 Then
MsgBox "There is no entry in cell C2 in sheet """ & wstSheet1.Name & """ to search on." & vbNewLine & "Enter one and try again.", vbExclamation, "My Data Match Editor"
Exit Sub
End If
Set rngFoundCell = wstSheet1.Range("B5:B" & wstSheet1.Cells(Rows.Count, "B").End(xlUp).Row).Find(What:=wstSheet1.Range("C2").Value)
If Not rngFoundCell Is Nothing Then
lngMatchRow1 = rngFoundCell.Row
Set rngFoundCell = Nothing
Else
MsgBox "There is no matching entry for """ & wstSheet1.Range("C2") & """ in Col. B of sheet """ & wstSheet1.Name & """.", vbInformation, "My Data Match Editor"
Set wstSheet1 = Nothing: Set wstSheet2 = Nothing: Set rngFoundCell = Nothing
Exit Sub
End If
Set rngFoundCell = wstSheet2.Range("B5:B" & wstSheet2.Cells(Rows.Count, "B").End(xlUp).Row).Find(What:=wstSheet1.Range("C2").Value)
If Not rngFoundCell Is Nothing Then
lngMatchRow2 = rngFoundCell.Row
Set rngFoundCell = Nothing
Else
MsgBox "There is no matching entry for """ & wstSheet1.Range("C2") & """ in Col. B of sheet """ & wstSheet2.Name & """.", vbInformation, "My Data Match Editor"
Set wstSheet1 = Nothing: Set wstSheet2 = Nothing: Set rngFoundCell = Nothing
Exit Sub
End If
wstSheet1.Range("D" & lngMatchRow1 & ":G" & lngMatchRow1).Value = wstSheet2.Range("D" & lngMatchRow2 & ":G" & lngMatchRow2).Value
Application.ScreenUpdating = True
MsgBox "The matching data from tab """ & wstSheet2.Name & """ has now been imported to sheet """ & wstSheet1.Name & """.", vbInformation, "My Data Match Editor"
Set wstSheet1 = Nothing: Set wstSheet2 = Nothing
End Sub
Regards,
Robert
Bookmarks