Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello All.
I have a spreadsheet with data from columns A - P. Each Row has a date and an associated profit/loss amount. Each row does not have a unique date, so it is possible that row 2 and 4 may have the same date, for example. I have rewritten in column Q and R the date (column Q) and P/L (column R). Column T has the unique Date from the earliest to the latest. Now, here is my question as my VB writing may be missing some technicalities. I created a nested For/Next loop to examine column T's date and compare the dates in Column Q and if it matches, add up the p/L. The result is to print in column U and I am not getting anything to print. Here is what I have so far...any guidance is appreciated. Sub ProcessCells() Dim Cnt As Long Dim MaxRows As Long Dim DailyTotal As Integer DailyTotal = 0 MaxRows = Rows.Count - 1 DateTotal = Cells(Rows.Count, 20).Value For DateRng = 2 To DateTotal For Cnt = 2 To MaxRows If Worksheets("Beta Test Trade Sheet").Cells(Cnt, 17).Value = Worksheets("Beta Test Trade Sheet").Cells(DateRng, 20).Value Then DailyTotal = DailyTotal + Worksheets("Beta Test Trade Sheet").Cells(Cnt, 18).Value Next Cnt Worksheets("Beta Test Trade Sheet").Cells(DateRng, 21).Value = Worksheets("Beta Test Trade Sheet").Cells(DateRng - 1, 21).Value + DailyTotal Next DateRng End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I group and transpose data - macro help needed. | Excel Worksheet Functions | |||
Macro to group data in pivot charts | Excel Programming | |||
Creating a preato from a group of data choosen from a pivot chart | Excel Discussion (Misc queries) | |||
Q: Creating a macro to sort and group columns in a sheet according to another sheet | Excel Programming | |||
Creating a graph based on a chosen group of data | Charts and Charting in Excel |