Kindly help to update to this fill

lathish

New Member
Joined
Feb 10, 2018
Messages
15
HEY GUYS PLEASE HELP


THERE 3 WORKSHEETS

SHEET 1

[TABLE="width: 214"]
<colgroup><col><col span="2"></colgroup><tbody>[TR]
[TD]PRODUCT[/TD]
[TD]MRP[/TD]
[TD]QTY[/TD]
[/TR]
[TR]
[TD]AA[/TD]
[TD]120[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]BB[/TD]
[TD]121[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]CC[/TD]
[TD]122[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]DD[/TD]
[TD]123[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]EE[/TD]
[TD]124[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]FF[/TD]
[TD]125[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]GG[/TD]
[TD]126[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]HH[/TD]
[TD]127[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]II[/TD]
[TD]128[/TD]
[TD]10[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 278"]
<colgroup><col><col span="3"></colgroup><tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]

[/TD]
[/TR]
</tbody>[/TABLE]

SHEET 2

[TABLE="width: 128"]
<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl66, width: 64"]PRODUCT[/TD]
[TD="class: xl66, width: 64"]CODE[/TD]
[/TR]
[TR]
[TD="class: xl66"]AA[/TD]
[TD="class: xl65"]300[/TD]
[/TR]
[TR]
[TD="class: xl66"]BB[/TD]
[TD="class: xl65"]300[/TD]
[/TR]
[TR]
[TD="class: xl66"]CC[/TD]
[TD="class: xl65"]300[/TD]
[/TR]
[TR]
[TD="class: xl66"]DD[/TD]
[TD="class: xl65"]200[/TD]
[/TR]
[TR]
[TD="class: xl66"]EE[/TD]
[TD="class: xl65"]200[/TD]
[/TR]
[TR]
[TD="class: xl66"]FF[/TD]
[TD="class: xl65"]300[/TD]
[/TR]
[TR]
[TD="class: xl66"]GG[/TD]
[TD="class: xl65"]500[/TD]
[/TR]
[TR]
[TD="class: xl66"]HH[/TD]
[TD="class: xl65"]500[/TD]
[/TR]
[TR]
[TD="class: xl66"]II[/TD]
[TD="class: xl65"]500[/TD]
[/TR]
[TR]
[TD="class: xl66"]JJ[/TD]
[TD="class: xl66, align: right"]300[/TD]
[/TR]
[TR]
[TD="class: xl66"]KK[/TD]
[TD="class: xl66, align: right"]500[/TD]
[/TR]
[TR]
[TD="class: xl66"]LL[/TD]
[TD="class: xl66, align: right"]500[/TD]
[/TR]
[TR]
[TD="class: xl66"]MM[/TD]
[TD="class: xl66, align: right"]200[/TD]
[/TR]
[TR]
[TD="class: xl66"]NN[/TD]
[TD="class: xl66, align: right"]200[/TD]
[/TR]
</tbody>[/TABLE]

SHEET 3

[TABLE="width: 256"]
<colgroup><col width="64" span="4" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl65, width: 64"]PRODUCT [/TD]
[TD="class: xl65, width: 64"]CODE [/TD]
[TD="class: xl65, width: 64"]MRP[/TD]
[TD="class: xl65, width: 64"]QTY[/TD]
[/TR]
[TR]
[TD="class: xl65"]AA[/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[/TR]
[TR]
[TD="class: xl65"]CC[/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[/TR]
[TR]
[TD="class: xl65"]DD[/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[/TR]
[TR]
[TD="class: xl65"]II[/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[TD="class: xl65"] [/TD]
[/TR]
</tbody>[/TABLE]


SHEET 3 WILL BE MY RESULT SHEET IN WHICH I HAVE TO FIND CODE FROM SHEET LATER ONCE CODE IS UPDATED THEN IN SHEET 3 REMAINING DATA SHOULD BE PASTE TO SHEET 3 FROM SHEET 1

RESULT[TABLE="width: 256"]
<colgroup><col width="64" span="4" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl65, width: 64"]
PRODUCT[/TD]
[TD="class: xl65, width: 64"] CODE [/TD]
[TD="class: xl65, width: 64"]MRP[/TD]
[TD="class: xl65, width: 64"]QTY[/TD]
[/TR]
[TR]
[TD="class: xl65"]AA[/TD]
[TD="class: xl65, align: right"]300[/TD]
[TD="class: xl65, align: right"]120[/TD]
[TD="class: xl65, align: right"]2[/TD]
[/TR]
[TR]
[TD="class: xl65"]CC[/TD]
[TD="class: xl65, align: right"]300[/TD]
[TD="class: xl65, align: right"]122[/TD]
[TD="class: xl65, align: right"]4[/TD]
[/TR]
[TR]
[TD="class: xl65"]DD[/TD]
[TD="class: xl65, align: right"]200[/TD]
[TD="class: xl65, align: right"]123[/TD]
[TD="class: xl65, align: right"]5[/TD]
[/TR]
[TR]
[TD="class: xl65"]II[/TD]
[TD="class: xl65, align: right"]500[/TD]
[TD="class: xl65, align: right"]128[/TD]
[TD="class: xl65, align: right"]10[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Try this:-
Code:
[COLOR="Navy"]Sub[/COLOR] MG06Mar34
[COLOR="Navy"]Dim[/COLOR] Rng1 [COLOR="Navy"]As[/COLOR] Range, Rng2 [COLOR="Navy"]As[/COLOR] Range, ray [COLOR="Navy"]As[/COLOR] Variant, Dn [COLOR="Navy"]As[/COLOR] Range, Ac [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Dim[/COLOR] R1 [COLOR="Navy"]As[/COLOR] Range, R2 [COLOR="Navy"]As[/COLOR] Range, Q [COLOR="Navy"]As[/COLOR] Variant, Rng [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]With[/COLOR] Sheets("Sheet1")
    [COLOR="Navy"]Set[/COLOR] Rng1 = .Range("A2", .Range("A" & Rows.Count).End(xlUp))
[COLOR="Navy"]End[/COLOR] With
[COLOR="Navy"]With[/COLOR] Sheets("Sheet2")
    [COLOR="Navy"]Set[/COLOR] Rng2 = .Range("A2", .Range("A" & Rows.Count).End(xlUp))
[COLOR="Navy"]End[/COLOR] With
ray = Array(Rng1, Rng2)
[COLOR="Navy"]With[/COLOR] CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
[COLOR="Navy"]For[/COLOR] Ac = 0 To 1
    [COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] ray(Ac)
        [COLOR="Navy"]Set[/COLOR] R1 = Nothing
        [COLOR="Navy"]Set[/COLOR] R2 = Nothing
        [COLOR="Navy"]If[/COLOR] Not .exists(Dn.Value) [COLOR="Navy"]Then[/COLOR]
            [COLOR="Navy"]If[/COLOR] Ac = 0 Then: [COLOR="Navy"]Set[/COLOR] R1 = Dn: Else: [COLOR="Navy"]Set[/COLOR] R2 = Dn
           .Add Dn.Value, Array(R1, R2)
        [COLOR="Navy"]Else[/COLOR]
            Q = .Item(Dn.Value)
              [COLOR="Navy"]If[/COLOR] Ac = 0 Then: [COLOR="Navy"]Set[/COLOR] Q(0) = Dn: Else: [COLOR="Navy"]Set[/COLOR] Q(1) = Dn
            .Item(Dn.Value) = Q
       [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR]
[COLOR="Navy"]Next[/COLOR] Ac
[COLOR="Navy"]With[/COLOR] Sheets("Sheet3")
[COLOR="Navy"]Set[/COLOR] Rng = .Range("A2", .Range("A" & Rows.Count).End(xlUp))
[COLOR="Navy"]End[/COLOR] With
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
    [COLOR="Navy"]If[/COLOR] .exists(Dn.Value) [COLOR="Navy"]Then[/COLOR]
        Dn.Offset(, 1) = .Item(Dn.Value)(1).Offset(, 1)
        Dn.Offset(, 2) = .Item(Dn.Value)(0).Offset(, 1)
        Dn.Offset(, 3) = .Item(Dn.Value)(0).Offset(, 2)
    [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR] Dn
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]With[/COLOR]
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
lathish,

Please test the following macro on a copy or your workbook/worksheets.

Code:
Sub lathish()
' hiker95, 03/06/2018, ME1046267
Application.ScreenUpdating = False
Dim w1 As Worksheet, w2 As Worksheet, w3 As Worksheet
Dim r As Range, w2a As Range, w1a As Range
Set w1 = Sheets("SHEET 1")
Set w2 = Sheets("SHEET 2")
Set w3 = Sheets("SHEET 3")
With w3
  For Each r In .Range("A2", .Range("A" & Rows.Count).End(xlUp))
    Set w2a = w2.Columns(1).Find(r.Value, LookAt:=xlWhole)
    If Not w2a Is Nothing Then
      r.Offset(, 1).Value = w2.Range("B" & w2a.Row).Value
    End If
    Set w1a = w1.Columns(1).Find(r.Value, LookAt:=xlWhole)
    If Not w1a Is Nothing Then
      r.Offset(, 2).Value = w1.Range("B" & w1a.Row).Value
      r.Offset(, 3).Value = w1.Range("C" & w1a.Row).Value
    End If
  Next r
  .UsedRange.Columns.AutoFit
  .Activate
End With
Application.ScreenUpdating = True
End Sub
 
Upvote 0
how to link that code with excel or please tell me formulas

lathish,

Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

1. Copy the macro code
2. Open your NEW workbook
3. Press the keys ALT + F11 to open the Visual Basic Editor
4. Press the keys ALT + I to activate the Insert menu
5. Press M to insert a Standard Module
6. Where the cursor is flashing, paste the code
7. Press the keys ALT + Q to exit the Editor, and return to Excel
8. To run the macro from Excel press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.

Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm, and, answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,200
Members
453,022
Latest member
RobertV1609

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