Hi,
I'm very new to VBA coding and have relied on macro recording for the code below.
There are three dates in at workbook called "DATES" located in Cells B1:D1 - the code copies those dates and pastes them into a file called "DATA" in cells EU1:EW1
The file called DATA crunches the numbers and pastes to the last available row in a file called "RESULTS"
What I want to do is loop this process - but - add a day to the cells in B1:D1.
For example, if B1 = 25/10/2021 and C1 = 25/10/2020 and D1 = 24/10/2021
I want the next loop to be B1 = 26/10/2021 and C1 to be 26/10/2020 and D1 = 25/10/2021
Then it takes these dates, sends them to get crunched in DATA file then it pastes the data returned into the RESULTS file.
And it repeats this process on and on.
As a work around I am simply copying and pasting - the code below but changing the range to the row below (where I have inputted the dates required).
However, as a VBA rookie, I am interested in learning how I can loop this process to add a day on to the initial dates and repeat this process. All responses very gratefully recieved.
Code below
Range("B1:D1").Select
Selection.Copy
Windows("DATA).xlsx").Activate
Range("EU1:EW1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A755:EK755").Select
Range(Selection, Selection.End(xlUp)).Select
Application.CutCopyMode = False
Selection.Copy
Application.WindowState = xlNormal
Windows("Results.xlsx").Activate
ActiveWindow.SmallScroll Down:=119
Range("A1").End(xlDown).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Windows("DATES.xlsm").Activate
I'm very new to VBA coding and have relied on macro recording for the code below.
There are three dates in at workbook called "DATES" located in Cells B1:D1 - the code copies those dates and pastes them into a file called "DATA" in cells EU1:EW1
The file called DATA crunches the numbers and pastes to the last available row in a file called "RESULTS"
What I want to do is loop this process - but - add a day to the cells in B1:D1.
For example, if B1 = 25/10/2021 and C1 = 25/10/2020 and D1 = 24/10/2021
I want the next loop to be B1 = 26/10/2021 and C1 to be 26/10/2020 and D1 = 25/10/2021
Then it takes these dates, sends them to get crunched in DATA file then it pastes the data returned into the RESULTS file.
And it repeats this process on and on.
As a work around I am simply copying and pasting - the code below but changing the range to the row below (where I have inputted the dates required).
However, as a VBA rookie, I am interested in learning how I can loop this process to add a day on to the initial dates and repeat this process. All responses very gratefully recieved.
Code below
Range("B1:D1").Select
Selection.Copy
Windows("DATA).xlsx").Activate
Range("EU1:EW1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A755:EK755").Select
Range(Selection, Selection.End(xlUp)).Select
Application.CutCopyMode = False
Selection.Copy
Application.WindowState = xlNormal
Windows("Results.xlsx").Activate
ActiveWindow.SmallScroll Down:=119
Range("A1").End(xlDown).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Windows("DATES.xlsm").Activate