Copy Info from one sheet to another if a certain criteria is met

rclaudia58

New Member
Joined
Jul 1, 2008
Messages
1
Hello,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
I need help with the following problem:<o:p></o:p>
I have two sheets: Daily Report and Monthly Totals.<o:p></o:p>
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:p></o:p>
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:p></o:p>
Thank you for your help!<o:p></o:p>

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
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
It would have been helpful if you had given a small extract of the two sheets.
The configaration of sheet " montly totals" is not clear. Is it like the sheet below Please try to post the second sheet "monthly totals" using heml maker.
Book1
ABCDEFG
1discipline1-Jul2-Jul3-Jul4-Jul5-Jul
2
3
4
5a
6s
7d
8f
9g
10h
11j
12k
13l
14p
15o
monthly totals
 
Upvote 0

Forum statistics

Threads
1,214,957
Messages
6,122,466
Members
449,086
Latest member
kwindels

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