Fill the empty cells in column G & L of sheet4

Fill the empty cells in column G & L  of sheet4
copy  the data from sheet2 & sheet3 from column  D  of both the sheets  into sheet4 column G and column L
symbol sholud be same while doing this

plz see the sample file
Book1.xlsb
Sachin SinghAsked:
Who is Participating?
I wear a lot of hats...

"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.

Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Try this...

Sub FillEmptyCellSheet4()
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)
Next i

For i = 2 To UBound(x3, 1)
    dict.Item(x3(i, 2)) = x3(i, 4)
Next i

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))
        Else
            arrG(i, 1) = x4(i, 7)
        End If

        If x4(i, 12) = "" Then
            arrL(i, 1) = dict.Item(x4(i, 3))
        Else
            arrL(i, 1) = x4(i, 12)
        End If
    End If
Next i
ws4.Range("G1").Resize(lr, 1).Value = arrG
ws4.Range("L1").Resize(lr, 1).Value = arrL
Application.ScreenUpdating = True
End Sub

Open in new window

Click the button called "Fill Empty Cells Columns G & L" on Sheet4 to run the code.
Book1.xlsb
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sachin SinghAuthor Commented:
Thnx Neeraj Sir for ur great support
1
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.