cannot give this query a title

navinaaaaaa

Board Regular
Joined
Mar 22, 2009
Messages
50
i have got 2 sheets in a workbook

sheet 1 has data as below

col1 col2
817315 0.4
897228 0.6
805002 1.2
899892 0.6

897228 0.01
805002 1.8
817315 1.2

sheet 2 has format as below

col1 col2
805002 =1.2+1.8
897228 =0.6+0.01
899890 =0.6
817315 =0.4+1.2

how can i update sheet 2 from sheet1 using macros?
 

Some videos you may like

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

MickG

MrExcel MVP
Joined
Jan 9, 2008
Messages
14,841
Try :-
Code:
Sub Tran()
With Sheets("Sheet2")
Set Rng2 = .Range(.Range("A1"), .Range("A" & Rows.Count).End(xlUp))
.Columns("B").ClearContents
End With

Set Rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
For Each Dn2 In Rng2
    For Each Dn In Rng
        If Dn = Dn2 Then
            Dn2.Offset(, 1) = Dn2.Offset(, 1) + Dn.Offset(, 1)
        End If
    Next Dn
Next Dn2
End Sub
Mick
 

navinaaaaaa

Board Regular
Joined
Mar 22, 2009
Messages
50
But sheet 2 is repeating the rows.
i want only one entry of each type or item.
pm me your email id so that i can send you my file.
 

MickG

MrExcel MVP
Joined
Jan 9, 2008
Messages
14,841
Sheet(1) is the active sheet.!!
I assumed from your thread that You had a list of numbers in sheet (2) column (A) and you wished to assign to there offset Values (in Column "B") any Column(B) value in sheet(1) that had the same Column(A) value as sheet 2) column (A).
Please clarify!!
 

Watch MrExcel Video

Forum statistics

Threads
1,123,494
Messages
5,602,004
Members
414,490
Latest member
Rip181

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
Top