rclaudia58
New Member
- Joined
- Jul 1, 2008
- Messages
- 1
Hello,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
I need help with the following problem:<o></o>
I have two sheets: Daily Report and Monthly Totals.<o></o>
In the first sheet I have some statistic information. It is a small table that contains the following disciplines (B5 to B15), Data A (C5 to C15), Data B (D5 to D15), the date in Cell C18 and this info will be updated on a daily basis (I had built a macro that is doing that). The problem is that on the second page I have a table which contains the same disciplines but listed from 1 July until 31 July. I need a macro that will copy in the cell B4(Monthly Totals) the info contained in C5(Daily Report) and in the cell B5(Monthly Totals) C5-D5(Daily Report) in the respective column (meaning the one that has the same date as in C18 (Daily Report).<o></o>
This is the Macro that I put up together but somewhere I made a logical mistake since it is not returning the values correctly.<o></o>
Thank you for your help!<o></o>
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Data As Date
Data = Worksheets("Daily Report").Cells(18, 3).Value
i = 1
k = 4
Do
i = i + 1
For j = 4 To 24 Step 2
k = k + 1
If Cells(3, i).Value = Data Then Cells(j, i) = Worksheets("Daily Report").Cells(k, 3).Value: Cells(j + 1, i) = Worksheets("Daily Report").Cells(k, 3).Value - Worksheets("Daily Report").Cells(k, 4).Value
Next j
Loop Until i = 33
End Sub
I need help with the following problem:<o></o>
I have two sheets: Daily Report and Monthly Totals.<o></o>
In the first sheet I have some statistic information. It is a small table that contains the following disciplines (B5 to B15), Data A (C5 to C15), Data B (D5 to D15), the date in Cell C18 and this info will be updated on a daily basis (I had built a macro that is doing that). The problem is that on the second page I have a table which contains the same disciplines but listed from 1 July until 31 July. I need a macro that will copy in the cell B4(Monthly Totals) the info contained in C5(Daily Report) and in the cell B5(Monthly Totals) C5-D5(Daily Report) in the respective column (meaning the one that has the same date as in C18 (Daily Report).<o></o>
This is the Macro that I put up together but somewhere I made a logical mistake since it is not returning the values correctly.<o></o>
Thank you for your help!<o></o>
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Data As Date
Data = Worksheets("Daily Report").Cells(18, 3).Value
i = 1
k = 4
Do
i = i + 1
For j = 4 To 24 Step 2
k = k + 1
If Cells(3, i).Value = Data Then Cells(j, i) = Worksheets("Daily Report").Cells(k, 3).Value: Cells(j + 1, i) = Worksheets("Daily Report").Cells(k, 3).Value - Worksheets("Daily Report").Cells(k, 4).Value
Next j
Loop Until i = 33
End Sub