How can I use VBA Code to Scrape the Prime Rate?

mecerrato

Board Regular
Joined
Oct 5, 2015
Messages
174
Office Version
  1. 365
Platform
  1. Windows
Hi I am not an expert at all but do some light VBA and mostly from asking questions and using bits and pieces from sites like stackoverflow, thank you all for posting these answers publicly :)

I have an excel sheet that I must update the Prime rate daily, I usually get it from the bankrate site: Wall Street Prime Rate | WSJ Current Prime Rate Index

I honestly just learned the term scrape and was wondering if anyone has some code I can use to accomplish this and place in the a button or the worksheet activate event?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
I would use power query/get and transform data and found on the data tab of the ribbon.
Here is the Mcode
Power Query:
let
    Source = Web.Page(Web.Contents("https://www.bankrate.com/rates/interest-rates/wall-street-prime-rate/")),
    Data0 = Source{0}[Data]
in
    Data0
which returns
Column1This weekMonth agoYear ago
WSJ Prime Rate4.754.753.25
 
Upvote 0
I would use power query/get and transform data and found on the data tab of the ribbon.
Here is the Mcode
Power Query:
let
    Source = Web.Page(Web.Contents("https://www.bankrate.com/rates/interest-rates/wall-street-prime-rate/")),
    Data0 = Source{0}[Data]
in
    Data0
which returns
Column1This weekMonth agoYear ago
WSJ Prime Rate4.754.753.25
Do I create a sub routine with this code alone?
 
Upvote 0
Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

- Follow this link to learn how to install Power Query in Excel 2010 / 2013.

- Follow this link for an introduction to Power Query functionality.

- Follow this link for a video which demonstrates how to use Power Query code provided.
 
Upvote 0

Forum statistics

Threads
1,215,241
Messages
6,123,823
Members
449,127
Latest member
Cyko

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