Here's a simplified macro that works as far back as Excel 2007, original credit Samir Khan:
Sub GetBTCUSD()
Range("BTCUSD").Select
Selection.ClearContents
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;https://api.bitcoinaverage.com/ticker/USD/last", Destination:=Range("BTCUSD"))
.Name = "BTCUSD field that will pollute your Name Manager but I don't know how to get rid of"
.AdjustColumnWidth = False
.PreserveFormatting = True
.RefreshOnFileOpen = True
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCellsxlOverwriteCells
.SaveData = False
.RefreshPeriod = 0
.WebSingleBlockTextImport = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
To use the macro:
- Name a column in your spreadsheet "BTCUSD" (just click in the Name Box in the top left and type "BTCUSD"
- Add a button to the sheet (you can name it "Get BTCUSD")
- Create a new Macro and paste the code above
- Right click the button, choose Assign macro, and pick the
GetBTCUSD
macro.