VBA Loop through date range and copy/paste values into new Excel sheet.

Joined
Nov 29, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi Everyone,

I have an Excel sheet that's gathering data from a server based on the date range of 2 weeks.
Server Tag Name
1/1/2020 0:00
1/14/2020 11:5912/31/2020 11:59
DateValue
........

My goal is to copy the cells from date and value columns (10K+ rows) into another excel sheet named "NewExcel"

Then I would need to increment the date range by another 2 weeks eg. 1/15/2020 0:00 to 1/28/2020 11:59, copy/paste the new values, and add on to the "NewExcel" sheet. The for loop increment would stop at the set date at 12/31/2020 11:59 as shown in cell B3.

This needs to be done since the server can only spit out a specific amount of rows and I would need to pull years of data which can be tedious. I have used python before but I'm choosing to use VBA since this would be for other people to use as well and they may not necessarily have python downloaded. I found a few examples on this site where it shows how to copy and paste values to another sheet but I am still a little lost. Any help would be greatly appreciated and please let me know if I should elaborate on anything. Thanks!
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Have you found a solution?

If not, can you show us a sample of your data, and what goes into the NewExcel worksheet?
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,598
Members
449,089
Latest member
Motoracer88

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