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

#### rclaudia58

##### New Member
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>

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

Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

#### venkat1926

##### Well-known Member
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

Replies
3
Views
248
Replies
1
Views
257
Replies
5
Views
303
Replies
8
Views
570
Replies
0
Views
383

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,163,891
Messages
5,834,263
Members
430,273
Latest member
Windrunner

### 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.

### Which adblocker are you using?

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

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