私はこのvbaコードを持っています。私はこのモジュールを1分ごとにリフレッシュして、セルの値を変更したいと思っています。毎分VBAアップデートモジュール
私はApplication.Volatile
で試しましたが、それは役に立たないです。 Ctrl + Alt + F9をクリックしたときに表示されます。
ありがとうございました。
Function CryptoQuote()
Dim strURL As String, strCSV As String
strURL = "https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD"
Set http = CreateObject("msxml2.xmlhttp")
http.Open "GET", strURL, False
http.send
strCSV = http.responsetext
CryptoQuote = Val(onlydigits(strCSV))
Set http = Nothing
End Function
Function onlydigits(s As String) As String
Dim retval As String
Dim i As Integer
retval = ""
For i = 1 To Len(s)
If Mid(s, i, 1) >= "0" And Mid(s, i, 1) <= "9" Or Mid(s, i, 1) = "." Then
retval = retval + Mid(s, i, 1)
End If
Next
onlydigits = retval
End Function
私はCryptoQuoteをUDF(ユーザ定義関数)として呼び出しているとします。 Sheet1!A1 to = CryptoQuote()。これは正しいです? UDFには通常のSubに比べていくつかの制限があります。 – z32a7ul
https://drive.google.com/file/d/1z91TP2TFxc-QnDuDTu4rUzK7dBuTVIsa/view?usp=sharing –