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?
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
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
 
Upvote 0
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.
 
Upvote 0
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!!
 
Upvote 0

Forum statistics

Threads
1,215,492
Messages
6,125,115
Members
449,206
Latest member
burgsrus

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