Diagonal Paste Loop - Starting On a Date Value

jameshigginson

New Member
Joined
Jul 9, 2015
Messages
14
I have two workbooks - I want to transfer data from Workbook A to Workbook B. I will only be pasting From Workbook A to Workbook B once per day. The goal is to store the data in workbook B overtime.

Work Book A. Sheet 1 - Will have all the data I will be using
Work Book B. Sheet 1- Is where I need to post the data from work book A.

In work Book A - I need to be able to Copy 15 Cells horizontally Based on a starting Date. The starting will be a dynamic date - it will change to the day of - every day. The value for the starting date in this workbook is C1. The 15 Values I need to Copy will be C106 - Q106. I'm not sure if the starting date really matters - here because I will always be copying cell references C106 - Q106.

In work Book B - I need to transfer these 15 Cells From Book A - Diagonally. Starting on the same date as the starting date in work book A. Or the day of - date. Working outwards. This workbook will not have dynamic dates/ they are all static. I need to somehow figure out how I can paste them in a stepping motion outwards from the day of date. I will have the dates located in ROW 1. The first value will be pasted in Row 16, then the next value will move one column over and one row up to 15 and so forth - one column over and one row up. Ending on Row 2.

I figured some form of loop will be needed. I have no problem adjusting it - I just don't know enough to do a loop from scratch. Nor get it to find and start from the day of date. Attached are two screen shots of how im trying to transfer the data. In work book B. The Green Cells show were tomorrows data will go (once tomorrow comes of course).

Any help is greatly appreciated. Please and Thanks.
 

Attachments

  • WorkBook A.png
    WorkBook A.png
    28.7 KB · Views: 18
  • WorkBook B.png
    WorkBook B.png
    19.5 KB · Views: 17
Last edited:

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Maybe something like below once you pasted the data in workbook B (while still selecting the data) run the below macro

VBA Code:
Sub ShiftUp()

Dim c As Range

For Each c In Selection
    c.Copy c.Offset(y)
    y = y - 1
Next

Selection.Offset(, 1).Clear

End Sub

[Code edited to retain cell format]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

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