Creating a Macro to open CSV files and pasting on a sheet.

siow89

New Member
Joined
Jun 16, 2014
Messages
21
Hello,

i was wonder is there was any way I could go to the following website:

https://www.ieso.ca/imoweb/pubs/marketReports/daily/PUB_GenPlan_20140711.csv

and copy paste it into an excel sheet. What i would need is to get this page and the previous 7 days by changing the date "20140711" to "20140710" and so on. Each orevious day needs to be copy pasted to a different sheet.

As a new day occurs, I would like to delete the page 7 days ago and add the new day on a new sheet.
I hope this is clear enough.

Thank you!
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
your URL is not correct

Code:
[COLOR=#333333]Private Const s_URL As String = "[/COLOR][URL="https://www.ieso.ca/imoweb/pubs/marketReports/daily/PUB_GenPlan"]https://www.ieso.ca/imoweb/pubs/mark...ly/PUB_GenPlan[/URL][COLOR=#333333]_"
it should be

[/COLOR]
Code:
Private Const s_URL As String = "https://www.ieso.ca/imoweb/pubs/marketReports/daily/PUB_GenPlan_"
 
Upvote 0
I have the exact URL...
I copy pasted yours just to make sure but I still get the same error unfortunately...
 
Upvote 0
This line:

.Open bstrMethod:="GET", bstrUrl:=s_URL & Format$(Range("A1").Value, "YYYYMMDD") & ".csv", _
varAsync:=False
 
Upvote 0
I have a hunch that what you are typing in A1 is not what you think it is

if you type 20140718, this is not July 18th 2014. try to convert the cell to general number format, the right number (i.e. the number of days since 31 December 1899) should be

41838 for July 18th 2014.

you are getting an overflow error because excel does not handle over 20 million days since 31 Dec1899


use the date function to get the date that you want

<b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #BBB"><thead><tr style=" background-color: #DAE7F5;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">A1</th><td style="text-align:left">=DATE(<font color="Blue">2014,7,18</font>)</td></tr></tbody></table></td></tr></table><br />
 
Last edited:
Upvote 0
Yes, you are absolutely right!
But is there anyways to make excel read it in yyyymmdd format?
 
Upvote 0
Select your cell, type Control 1, this opens up custom formatting

go to Custom and type YYYYMMDD
 
Upvote 0

Forum statistics

Threads
1,215,510
Messages
6,125,228
Members
449,216
Latest member
biglake87

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