Excel VBA For Loop Data Matching

Published: 20 May 2019
on channel: Coding Module
16,167
210

If I was able to help you, feel free to donate.
Paypal: [email protected]

Sub match_Data()

Dim rSH As Worksheet
Dim sSh As Worksheet
Set rSH = ThisWorkbook.Sheets("RAW DATA")
Set sSh = ThisWorkbook.Sheets("SEARCH DATA")

Dim fName As String, lName As String

For a = 2 To sSh.Range("A" & Rows.Count).End(xlUp).Row
fName = sSh.Range("A" & a).Value
lName = sSh.Range("B" & a).Value

For b = 2 To rSH.Range("A" & Rows.Count).End(xlUp).Row
If rSH.Range("A" & b).Value = fName And rSH.Range("B" & b).Value = lName Then

sSh.Range("C" & a).Value = rSH.Range("D" & b).Value
sSh.Range("D" & a).Value = rSH.Range("E" & b).Value
sSh.Range("E" & a).Value = rSH.Range("F" & b).Value
sSh.Range("F" & a).Value = rSH.Range("H" & b).Value
sSh.Range("G" & a).Value = rSH.Range("J" & b).Value
Exit For
End If
Next b
Next a

Debug.Print "Completed"

End Sub


Watch video Excel VBA For Loop Data Matching online without registration, duration hours minute second in high quality. This video was added by user Coding Module 20 May 2019, don't forget to share it with your friends and acquaintances, it has been viewed on our site 16,167 once and liked it 210 people.