copy range and paste on next row that date match

eric86vabeach

New Member
Joined
Jan 29, 2014
Messages
23
what i would like to do is copy a range of data "B185:AA185" and cell "b185" has a "date/value" and paste range "B185:AA185" to the right on new page the new page would have "dates/values" going down the side of sheet and if "b185" match then paste row "C185:AA185" i would like to have the match/find due if a day is skip then i wount have to go to the master sheet and add new line


data sheet


[TABLE="width: 500"]
<TBODY>[TR]
[TD]row#[/TD]
[TD]A[/TD]
[TD]"B"[/TD]
[TD]"C"[/TD]
[TD]"D"[/TD]
[TD]"E"[/TD]
[TD]"F"[/TD]
[/TR]
[TR]
[TD]183[/TD]
[TD][/TD]
[TD] [/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]184[/TD]
[TD][/TD]
[TD]todays date[/TD]
[TD]Day[/TD]
[TD][/TD]
[TD]total sale[/TD]
[TD]other data[/TD]
[/TR]
[TR]
[TD]185[/TD]
[TD][/TD]
[TD]2/22/2014[/TD]
[TD]saturday[/TD]
[TD]February[/TD]
[TD]$100.95[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]186[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]187[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]188[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</TBODY>[/TABLE]

master sheet

[TABLE="width: 500"]
<TBODY>[TR]
[TD]row # [/TD]
[TD]Date[/TD]
[TD]day[/TD]
[TD]Mounth[/TD]
[TD]total sale[/TD]
[TD]other data[/TD]
[/TR]
[TR]
[TD]25[/TD]
[TD]2/22/2014[/TD]
[TD]Saturday[/TD]
[TD]February[/TD]
[TD]$100.95[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]26[/TD]
[TD]2/23/2014[/TD]
[TD]sunday[/TD]
[TD]February[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]27[/TD]
[TD]2/24/2014[/TD]
[TD]monday[/TD]
[TD]February[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]ect..[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</TBODY>[/TABLE]



Thanks for reading and the Help
Eric
 
Let me rephrase this wish:
You have a data sheet where for today the sales figures are put in always on row 185 (I assume a sum of table above).

At the end of the day you want to transfer this summary row to a master sheet to the appropriate day as listed in column A. The columns to be transferred are C:AA

In your workbook press Alt-F8, put xx in the box and press 'Create...'
The vba editor will open with 'sub xxx()' in the right hand panel
Delete all this and paste the following macro in its place:

<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> TransferDaySummary()<br>    <SPAN style="color:#00007F">Dim</SPAN> rIn <SPAN style="color:#00007F">As</SPAN> Range, rOut <SPAN style="color:#00007F">As</SPAN> Range<br>    <SPAN style="color:#00007F">Dim</SPAN> wsIn <SPAN style="color:#00007F">As</SPAN> Worksheet, wsOut <SPAN style="color:#00007F">As</SPAN> Worksheet<br>    <br>    <SPAN style="color:#00007F">Set</SPAN> wsIn = Sheets("Data")    <SPAN style="color:#007F00">' edit name of datasheet</SPAN><br>    <SPAN style="color:#00007F">Set</SPAN> wsOut = Sheets("Master") <SPAN style="color:#007F00">' edit name of Master sheet</SPAN><br>    <br>    <SPAN style="color:#00007F">Set</SPAN> rIn = wsIn.Range("A185")<br>    <br>    <SPAN style="color:#00007F">Set</SPAN> rOut = wsOut.Range("A:A").Find(what:=rIn.Value)<br>    <SPAN style="color:#00007F">If</SPAN> rOut <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN><br>        <SPAN style="color:#007F00">' date not found</SPAN><br>        MsgBox rIn.Value & " in cell " & rIn.Address & " not found in column A of sheet " & wsOut.Name<br>        <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br>    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br>    <SPAN style="color:#007F00">' copy the data accross</SPAN><br>    rOut.Offset(0, 1).Resize(1, 26).Value = rIn.Offset(0, 1).Resize(1, 26).Value<br>    <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>

Now go back to the spreadsheet. Again press Alt-F8. click (once) on the macro name 'TransferDaySummary' in the list and press 'Options...'
select a handy shortcut letter like Ctrl-shift T
OK out.

Now press Ctrl-shift-T in the spreadsheet and the line will be transferred.

Let me know if it works and how happy you are.
 
Upvote 0

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