Learn when you want, where you want with convenient online training courses. Sign up now!
Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
Dim ws2 As Worksheet, ws3 As Worksheet, ws4 As Worksheet
Dim x2, x3, x4, dict
Dim i As Long, lr As Long
Dim arrG(), arrL()
Application.ScreenUpdating = False
Set ws2 = Sheets("Sheet2")
Set ws3 = Sheets("Sheet3")
Set ws4 = Sheets("Sheet4")
lr = ws4.Cells(Rows.Count, 1).End(xlUp).Row
ReDim arrG(1 To lr, 1 To 1)
ReDim arrL(1 To lr, 1 To 1)
x2 = ws2.Range("A1").CurrentRegion.Value
x3 = ws3.Range("A1").CurrentRegion.Value
x4 = ws4.Range("A1:T" & lr).Value
Set dict = CreateObject("Scripting.Dictionary")
For i = 2 To UBound(x2, 1)
dict.Item(x2(i, 2)) = x2(i, 4)
For i = 2 To UBound(x3, 1)
dict.Item(x3(i, 2)) = x3(i, 4)
For i = 1 To UBound(x4, 1)
If dict.exists(x4(i, 3)) Then
If x4(i, 7) = "" Then
arrG(i, 1) = dict.Item(x4(i, 3))
arrG(i, 1) = x4(i, 7)
If x4(i, 12) = "" Then
arrL(i, 1) = dict.Item(x4(i, 3))
arrL(i, 1) = x4(i, 12)
ws4.Range("G1").Resize(lr, 1).Value = arrG
ws4.Range("L1").Resize(lr, 1).Value = arrL
Application.ScreenUpdating = True
Open in new window
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.