Dear Akhilesh Karna, Thank you very much for your help.
On Thu, May 7, 2009 at 9:56 AM, Akhilesh Karna <akhiles...@gmail.com> wrote: > You can use the following code (slightly changed from original). > > Sub RedemptionsUSD() > > Dim ModelCash As Worksheet > Dim CashFlow As Worksheet > Set ModelCash = Workbooks("Model.xls").Worksheets(1) > Set CashFlow = Workbooks("Model.xls").Worksheets(2) > Dim j As Integer > Dim c As Integer > 'set all values to zero at first > For c = 4 To 50 > ModelCash.Range("D" & c).Value = 0 > Next c > For j = 14 To 200 > For c = 4 To 50 > If CashFlow.Range("D" & j).Value = ModelCash.Range("A" & > c).Value And CashFlow.Range("C" & j) = "USD" Then > 'add to the original value every time the same date is found > ModelCash.Range("D" & c).Value = ModelCash.Range("D" & > c).Value + CashFlow.Range("B" & j).Value > > End If > Next c > Next j > > End Sub > > Akhilesh Kumar Karna > > > > On Wed, May 6, 2009 at 2:43 PM, Samir Agayev <saga...@gmail.com> wrote: > >> Dear Group members, >> >> In attached excel file, I have a little vba code. >> >> It gets data from Column B in Sheet2 to Column D in Sheet1 if Column D in >> Sheet2 equals Column A in Sheet1. >> >> The only problem occurs when the Items of Column D in Sheet2 are not >> unique. You can see there three 15-May-09. So it gets only the last data, >> which is 100,000,000.00 (at B19 in Sheet2), and ignores B17 and B18). >> >> Is there any way of improving this code to get the sum of B17, B18 and B20 >> into D13 in Sheet1? >> >> Thank you in advance. >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---