Instead of creating all of those queries, you can make a single query with all of the data from the web site and load that to Excel's "data model". You can then create a pivot table and use slicers to display data for the country or countries that you want. Take a look at this example which nicely shows how Power Query can clean up and manipulate data. For example,
Some of the changes listed in the table had both plus and minus, as in "+-0.37", which produced an error when changing the data type to decimal. Using replace values to remove the "+"'s in this column fixed the error without changing the numbers.
I wanted to split the bond types (e.g., "10Y", "6M") into length (10, 6) and period (Y, M). PQ provides a couple of options for splitting. I first tried splitting by one character from the right, only to discover that there was a bond type "Overnight" which got split into "Overnigh" and "t"! I then tried the "Digit to non-Digit" option which nicely split 10Y and 6M but left Overnight in the first column instead of moving it to the second. Finally solved this by using Transform -> Format to add a prefix of 0 to the column before splitting. This split Overnight properly and didn't affect the length values when they got converted to numbers.
Finally, if you want to refresh queries in VBA you can use this syntax:
Code:
ThisWorkbook.Connections("Query - Argentina").Refresh
Norm
Bookmarks