Exchange rate excel










-1















I want to write a date in excel and get the rate by this date.



I search solutions but not found something that can help me.



It's could be vba or non vba, someone have a solution for me?

I am using Excel 2016.



Thank you.



My code:



Function CryptoQuote(enteredDate As String)
If IsDate(enteredDate) Then
enteredDate = Format(Date, "yyyy-mm-dd")
Dim strURL As String: strURL = "http://www.x-rates.com/historical/?from=USD&amount=1&date=" & enteredDate
MsgBox strURL
Dim http As Object: Set http = CreateObject("msxml2.xmlhttp")
http.Open "GET", strURL, False
http.Send
Dim strCSV As String
Found = InStr(http.responseText, "/graph/?from=USD&to=ILS") 'find this in the HTML
If Found <> 0 Then
Length = Len(http.responseText) - Found 'check the length of the HTML
strCSV = Right(http.responseText, Length) 'Trim the begining of the String until we get to our value
strCSV = Left(strCSV, Len(strCSV) - (Len(strCSV) - 36)) 'Trim the end of the string to leave only the value we are looking for
strCSV = Replace(strCSV, "graph/?from=USD&amp;to=ILS'>", "") 'replace the original search string with nothing so we are left with numbers only
Else
CryptoQuote = "Could not find the data!"
End If
Else
MsgBox "Please enter a correct date as yyyy-mm-dd"
End If
CryptoQuote = Val(strCSV)
MsgBox strCSV
End Function









share|improve this question
























  • Get the rate of what? From where?

    – Xabier
    Dec 8 '17 at 11:54











  • Foreign Exchange Rate? Like GBP/USD? Try yahoo finance.

    – S Meaden
    Dec 8 '17 at 11:55











  • I want get rate of USD by history date in Excel. How can I use yahoo finance in excel?

    – Maxim Baran
    Dec 8 '17 at 11:59







  • 1





    PLease tag your version of Excel. Since version 2013, MS introduced some webservices functions and that could impact the answer

    – Patrick Honorez
    Dec 8 '17 at 12:23






  • 1





    You might want to search the web for the solution stipulated by @PatrickHonorez: thespreadsheetguru.com/blog/… OR kx.cloudingenium.com/content-providers/… OR financial-modelling.net/tutorials/excel/…

    – Ralph
    Dec 8 '17 at 12:54
















-1















I want to write a date in excel and get the rate by this date.



I search solutions but not found something that can help me.



It's could be vba or non vba, someone have a solution for me?

I am using Excel 2016.



Thank you.



My code:



Function CryptoQuote(enteredDate As String)
If IsDate(enteredDate) Then
enteredDate = Format(Date, "yyyy-mm-dd")
Dim strURL As String: strURL = "http://www.x-rates.com/historical/?from=USD&amount=1&date=" & enteredDate
MsgBox strURL
Dim http As Object: Set http = CreateObject("msxml2.xmlhttp")
http.Open "GET", strURL, False
http.Send
Dim strCSV As String
Found = InStr(http.responseText, "/graph/?from=USD&amp;to=ILS") 'find this in the HTML
If Found <> 0 Then
Length = Len(http.responseText) - Found 'check the length of the HTML
strCSV = Right(http.responseText, Length) 'Trim the begining of the String until we get to our value
strCSV = Left(strCSV, Len(strCSV) - (Len(strCSV) - 36)) 'Trim the end of the string to leave only the value we are looking for
strCSV = Replace(strCSV, "graph/?from=USD&amp;to=ILS'>", "") 'replace the original search string with nothing so we are left with numbers only
Else
CryptoQuote = "Could not find the data!"
End If
Else
MsgBox "Please enter a correct date as yyyy-mm-dd"
End If
CryptoQuote = Val(strCSV)
MsgBox strCSV
End Function









share|improve this question
























  • Get the rate of what? From where?

    – Xabier
    Dec 8 '17 at 11:54











  • Foreign Exchange Rate? Like GBP/USD? Try yahoo finance.

    – S Meaden
    Dec 8 '17 at 11:55











  • I want get rate of USD by history date in Excel. How can I use yahoo finance in excel?

    – Maxim Baran
    Dec 8 '17 at 11:59







  • 1





    PLease tag your version of Excel. Since version 2013, MS introduced some webservices functions and that could impact the answer

    – Patrick Honorez
    Dec 8 '17 at 12:23






  • 1





    You might want to search the web for the solution stipulated by @PatrickHonorez: thespreadsheetguru.com/blog/… OR kx.cloudingenium.com/content-providers/… OR financial-modelling.net/tutorials/excel/…

    – Ralph
    Dec 8 '17 at 12:54














-1












-1








-1


0






I want to write a date in excel and get the rate by this date.



I search solutions but not found something that can help me.



It's could be vba or non vba, someone have a solution for me?

I am using Excel 2016.



Thank you.



My code:



Function CryptoQuote(enteredDate As String)
If IsDate(enteredDate) Then
enteredDate = Format(Date, "yyyy-mm-dd")
Dim strURL As String: strURL = "http://www.x-rates.com/historical/?from=USD&amount=1&date=" & enteredDate
MsgBox strURL
Dim http As Object: Set http = CreateObject("msxml2.xmlhttp")
http.Open "GET", strURL, False
http.Send
Dim strCSV As String
Found = InStr(http.responseText, "/graph/?from=USD&amp;to=ILS") 'find this in the HTML
If Found <> 0 Then
Length = Len(http.responseText) - Found 'check the length of the HTML
strCSV = Right(http.responseText, Length) 'Trim the begining of the String until we get to our value
strCSV = Left(strCSV, Len(strCSV) - (Len(strCSV) - 36)) 'Trim the end of the string to leave only the value we are looking for
strCSV = Replace(strCSV, "graph/?from=USD&amp;to=ILS'>", "") 'replace the original search string with nothing so we are left with numbers only
Else
CryptoQuote = "Could not find the data!"
End If
Else
MsgBox "Please enter a correct date as yyyy-mm-dd"
End If
CryptoQuote = Val(strCSV)
MsgBox strCSV
End Function









share|improve this question
















I want to write a date in excel and get the rate by this date.



I search solutions but not found something that can help me.



It's could be vba or non vba, someone have a solution for me?

I am using Excel 2016.



Thank you.



My code:



Function CryptoQuote(enteredDate As String)
If IsDate(enteredDate) Then
enteredDate = Format(Date, "yyyy-mm-dd")
Dim strURL As String: strURL = "http://www.x-rates.com/historical/?from=USD&amount=1&date=" & enteredDate
MsgBox strURL
Dim http As Object: Set http = CreateObject("msxml2.xmlhttp")
http.Open "GET", strURL, False
http.Send
Dim strCSV As String
Found = InStr(http.responseText, "/graph/?from=USD&amp;to=ILS") 'find this in the HTML
If Found <> 0 Then
Length = Len(http.responseText) - Found 'check the length of the HTML
strCSV = Right(http.responseText, Length) 'Trim the begining of the String until we get to our value
strCSV = Left(strCSV, Len(strCSV) - (Len(strCSV) - 36)) 'Trim the end of the string to leave only the value we are looking for
strCSV = Replace(strCSV, "graph/?from=USD&amp;to=ILS'>", "") 'replace the original search string with nothing so we are left with numbers only
Else
CryptoQuote = "Could not find the data!"
End If
Else
MsgBox "Please enter a correct date as yyyy-mm-dd"
End If
CryptoQuote = Val(strCSV)
MsgBox strCSV
End Function






excel-vba vba excel






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 9 '18 at 19:34









Community

11




11










asked Dec 8 '17 at 11:52









Maxim BaranMaxim Baran

14




14












  • Get the rate of what? From where?

    – Xabier
    Dec 8 '17 at 11:54











  • Foreign Exchange Rate? Like GBP/USD? Try yahoo finance.

    – S Meaden
    Dec 8 '17 at 11:55











  • I want get rate of USD by history date in Excel. How can I use yahoo finance in excel?

    – Maxim Baran
    Dec 8 '17 at 11:59







  • 1





    PLease tag your version of Excel. Since version 2013, MS introduced some webservices functions and that could impact the answer

    – Patrick Honorez
    Dec 8 '17 at 12:23






  • 1





    You might want to search the web for the solution stipulated by @PatrickHonorez: thespreadsheetguru.com/blog/… OR kx.cloudingenium.com/content-providers/… OR financial-modelling.net/tutorials/excel/…

    – Ralph
    Dec 8 '17 at 12:54


















  • Get the rate of what? From where?

    – Xabier
    Dec 8 '17 at 11:54











  • Foreign Exchange Rate? Like GBP/USD? Try yahoo finance.

    – S Meaden
    Dec 8 '17 at 11:55











  • I want get rate of USD by history date in Excel. How can I use yahoo finance in excel?

    – Maxim Baran
    Dec 8 '17 at 11:59







  • 1





    PLease tag your version of Excel. Since version 2013, MS introduced some webservices functions and that could impact the answer

    – Patrick Honorez
    Dec 8 '17 at 12:23






  • 1





    You might want to search the web for the solution stipulated by @PatrickHonorez: thespreadsheetguru.com/blog/… OR kx.cloudingenium.com/content-providers/… OR financial-modelling.net/tutorials/excel/…

    – Ralph
    Dec 8 '17 at 12:54

















Get the rate of what? From where?

– Xabier
Dec 8 '17 at 11:54





Get the rate of what? From where?

– Xabier
Dec 8 '17 at 11:54













Foreign Exchange Rate? Like GBP/USD? Try yahoo finance.

– S Meaden
Dec 8 '17 at 11:55





Foreign Exchange Rate? Like GBP/USD? Try yahoo finance.

– S Meaden
Dec 8 '17 at 11:55













I want get rate of USD by history date in Excel. How can I use yahoo finance in excel?

– Maxim Baran
Dec 8 '17 at 11:59






I want get rate of USD by history date in Excel. How can I use yahoo finance in excel?

– Maxim Baran
Dec 8 '17 at 11:59





1




1





PLease tag your version of Excel. Since version 2013, MS introduced some webservices functions and that could impact the answer

– Patrick Honorez
Dec 8 '17 at 12:23





PLease tag your version of Excel. Since version 2013, MS introduced some webservices functions and that could impact the answer

– Patrick Honorez
Dec 8 '17 at 12:23




1




1





You might want to search the web for the solution stipulated by @PatrickHonorez: thespreadsheetguru.com/blog/… OR kx.cloudingenium.com/content-providers/… OR financial-modelling.net/tutorials/excel/…

– Ralph
Dec 8 '17 at 12:54






You might want to search the web for the solution stipulated by @PatrickHonorez: thespreadsheetguru.com/blog/… OR kx.cloudingenium.com/content-providers/… OR financial-modelling.net/tutorials/excel/…

– Ralph
Dec 8 '17 at 12:54













3 Answers
3






active

oldest

votes


















0














If what you want is USD to EUR then this will do the job (not the most elegant way of doing things but it will do the task at hand):



Public Sub CryptoQuote()
enteredDate = InputBox("Please enter the search date: ", "Enter Date")
If IsDate(enteredDate) Then
enteredDate = Format(Date, "yyyy-mm-dd")
Dim strURL As String: strURL = "http://www.x-rates.com/historical/?from=USD&amount=1&date=" & enteredDate
Dim http As Object: Set http = CreateObject("msxml2.xmlhttp")
http.Open "GET", strURL, False
http.send
Dim strCSV As String
Found = InStr(http.responsetext, "/graph/?from=USD&amp;to=EUR") 'find this in the HTML
If Found <> 0 Then
Length = Len(http.responsetext) - Found 'check the length of the HTML
strCSV = Right(http.responsetext, Length) 'Trim the begining of the String until we get to our value
strCSV = Left(strCSV, Len(strCSV) - (Len(strCSV) - 36)) 'Trim the end of the string to leave only the value we are looking for
strCSV = Replace(strCSV, "graph/?from=USD&amp;to=EUR'>", "") 'replace the original search string with nothing so we are left with numbers only
Else
MsgBox "Could not find the data!"
End If
Else
MsgBox "Please enter a correct date as yyyy-mm-dd"
End If
MsgBox "The rate for 1 USD in EURO is " & strCSV
End Sub





share|improve this answer























  • thank you very much! can i calling CryptoQuote as a UDF (user defined function)?

    – Maxim Baran
    Dec 8 '17 at 15:46











  • No problem,.. Of course you can call the Subroutine from other places too, I guess it's probably best if you play with it and see what you are able to do.. Any issues, I will be happy to help. :)

    – Xabier
    Dec 8 '17 at 15:50











  • hi friend, i change my code, thats always return me the date of today.

    – Maxim Baran
    Dec 8 '17 at 16:00











  • If you are going to pass the enteredDate as a string, maybe you should also remove the If IsDate(enteredDate) Then, as it will not be a date, it will be a string instead, also you should do some validation before you call the macro to make sure that the date is formatted correctly... but yeah this should work also...

    – Xabier
    Dec 8 '17 at 16:03











  • thank you.. i removed enteredDate = Format(Date, "yyyy-mm-dd")

    – Maxim Baran
    Dec 8 '17 at 16:13


















0














Is this what you want?



Sub gethtmltable()
Dim objWeb As QueryTable
Dim sWebTable As String
'You have to count down the tables on the URL listed in your query
'This example shows how to retrieve the 2nd table from the web page.
sWebTable = 2
'Sets the url to run the query and the destination in the excel file
'You can change both to suit your needs

LValue = Format(Date, "yyyy-mm-dd")
Set objWeb = ActiveSheet.QueryTables.Add( _
Connection:="URL;http://www.x-rates.com/historical/?from=USD&amount=1&date=" & LValue, _
Destination:=Range("A1"))

With objWeb

.WebSelectionType = xlSpecifiedTables
.WebTables = sWebTable
.Refresh BackgroundQuery:=False
.SaveData = True
End With
Set objWeb = Nothing
End Sub





share|improve this answer






























    0














    They changed to HTTPS, so make sure that you use https://www.x-rates.com over http://www.x-rates.com. The rest works fine without changes.






    share|improve this answer
























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f47713889%2fexchange-rate-excel%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      If what you want is USD to EUR then this will do the job (not the most elegant way of doing things but it will do the task at hand):



      Public Sub CryptoQuote()
      enteredDate = InputBox("Please enter the search date: ", "Enter Date")
      If IsDate(enteredDate) Then
      enteredDate = Format(Date, "yyyy-mm-dd")
      Dim strURL As String: strURL = "http://www.x-rates.com/historical/?from=USD&amount=1&date=" & enteredDate
      Dim http As Object: Set http = CreateObject("msxml2.xmlhttp")
      http.Open "GET", strURL, False
      http.send
      Dim strCSV As String
      Found = InStr(http.responsetext, "/graph/?from=USD&amp;to=EUR") 'find this in the HTML
      If Found <> 0 Then
      Length = Len(http.responsetext) - Found 'check the length of the HTML
      strCSV = Right(http.responsetext, Length) 'Trim the begining of the String until we get to our value
      strCSV = Left(strCSV, Len(strCSV) - (Len(strCSV) - 36)) 'Trim the end of the string to leave only the value we are looking for
      strCSV = Replace(strCSV, "graph/?from=USD&amp;to=EUR'>", "") 'replace the original search string with nothing so we are left with numbers only
      Else
      MsgBox "Could not find the data!"
      End If
      Else
      MsgBox "Please enter a correct date as yyyy-mm-dd"
      End If
      MsgBox "The rate for 1 USD in EURO is " & strCSV
      End Sub





      share|improve this answer























      • thank you very much! can i calling CryptoQuote as a UDF (user defined function)?

        – Maxim Baran
        Dec 8 '17 at 15:46











      • No problem,.. Of course you can call the Subroutine from other places too, I guess it's probably best if you play with it and see what you are able to do.. Any issues, I will be happy to help. :)

        – Xabier
        Dec 8 '17 at 15:50











      • hi friend, i change my code, thats always return me the date of today.

        – Maxim Baran
        Dec 8 '17 at 16:00











      • If you are going to pass the enteredDate as a string, maybe you should also remove the If IsDate(enteredDate) Then, as it will not be a date, it will be a string instead, also you should do some validation before you call the macro to make sure that the date is formatted correctly... but yeah this should work also...

        – Xabier
        Dec 8 '17 at 16:03











      • thank you.. i removed enteredDate = Format(Date, "yyyy-mm-dd")

        – Maxim Baran
        Dec 8 '17 at 16:13















      0














      If what you want is USD to EUR then this will do the job (not the most elegant way of doing things but it will do the task at hand):



      Public Sub CryptoQuote()
      enteredDate = InputBox("Please enter the search date: ", "Enter Date")
      If IsDate(enteredDate) Then
      enteredDate = Format(Date, "yyyy-mm-dd")
      Dim strURL As String: strURL = "http://www.x-rates.com/historical/?from=USD&amount=1&date=" & enteredDate
      Dim http As Object: Set http = CreateObject("msxml2.xmlhttp")
      http.Open "GET", strURL, False
      http.send
      Dim strCSV As String
      Found = InStr(http.responsetext, "/graph/?from=USD&amp;to=EUR") 'find this in the HTML
      If Found <> 0 Then
      Length = Len(http.responsetext) - Found 'check the length of the HTML
      strCSV = Right(http.responsetext, Length) 'Trim the begining of the String until we get to our value
      strCSV = Left(strCSV, Len(strCSV) - (Len(strCSV) - 36)) 'Trim the end of the string to leave only the value we are looking for
      strCSV = Replace(strCSV, "graph/?from=USD&amp;to=EUR'>", "") 'replace the original search string with nothing so we are left with numbers only
      Else
      MsgBox "Could not find the data!"
      End If
      Else
      MsgBox "Please enter a correct date as yyyy-mm-dd"
      End If
      MsgBox "The rate for 1 USD in EURO is " & strCSV
      End Sub





      share|improve this answer























      • thank you very much! can i calling CryptoQuote as a UDF (user defined function)?

        – Maxim Baran
        Dec 8 '17 at 15:46











      • No problem,.. Of course you can call the Subroutine from other places too, I guess it's probably best if you play with it and see what you are able to do.. Any issues, I will be happy to help. :)

        – Xabier
        Dec 8 '17 at 15:50











      • hi friend, i change my code, thats always return me the date of today.

        – Maxim Baran
        Dec 8 '17 at 16:00











      • If you are going to pass the enteredDate as a string, maybe you should also remove the If IsDate(enteredDate) Then, as it will not be a date, it will be a string instead, also you should do some validation before you call the macro to make sure that the date is formatted correctly... but yeah this should work also...

        – Xabier
        Dec 8 '17 at 16:03











      • thank you.. i removed enteredDate = Format(Date, "yyyy-mm-dd")

        – Maxim Baran
        Dec 8 '17 at 16:13













      0












      0








      0







      If what you want is USD to EUR then this will do the job (not the most elegant way of doing things but it will do the task at hand):



      Public Sub CryptoQuote()
      enteredDate = InputBox("Please enter the search date: ", "Enter Date")
      If IsDate(enteredDate) Then
      enteredDate = Format(Date, "yyyy-mm-dd")
      Dim strURL As String: strURL = "http://www.x-rates.com/historical/?from=USD&amount=1&date=" & enteredDate
      Dim http As Object: Set http = CreateObject("msxml2.xmlhttp")
      http.Open "GET", strURL, False
      http.send
      Dim strCSV As String
      Found = InStr(http.responsetext, "/graph/?from=USD&amp;to=EUR") 'find this in the HTML
      If Found <> 0 Then
      Length = Len(http.responsetext) - Found 'check the length of the HTML
      strCSV = Right(http.responsetext, Length) 'Trim the begining of the String until we get to our value
      strCSV = Left(strCSV, Len(strCSV) - (Len(strCSV) - 36)) 'Trim the end of the string to leave only the value we are looking for
      strCSV = Replace(strCSV, "graph/?from=USD&amp;to=EUR'>", "") 'replace the original search string with nothing so we are left with numbers only
      Else
      MsgBox "Could not find the data!"
      End If
      Else
      MsgBox "Please enter a correct date as yyyy-mm-dd"
      End If
      MsgBox "The rate for 1 USD in EURO is " & strCSV
      End Sub





      share|improve this answer













      If what you want is USD to EUR then this will do the job (not the most elegant way of doing things but it will do the task at hand):



      Public Sub CryptoQuote()
      enteredDate = InputBox("Please enter the search date: ", "Enter Date")
      If IsDate(enteredDate) Then
      enteredDate = Format(Date, "yyyy-mm-dd")
      Dim strURL As String: strURL = "http://www.x-rates.com/historical/?from=USD&amount=1&date=" & enteredDate
      Dim http As Object: Set http = CreateObject("msxml2.xmlhttp")
      http.Open "GET", strURL, False
      http.send
      Dim strCSV As String
      Found = InStr(http.responsetext, "/graph/?from=USD&amp;to=EUR") 'find this in the HTML
      If Found <> 0 Then
      Length = Len(http.responsetext) - Found 'check the length of the HTML
      strCSV = Right(http.responsetext, Length) 'Trim the begining of the String until we get to our value
      strCSV = Left(strCSV, Len(strCSV) - (Len(strCSV) - 36)) 'Trim the end of the string to leave only the value we are looking for
      strCSV = Replace(strCSV, "graph/?from=USD&amp;to=EUR'>", "") 'replace the original search string with nothing so we are left with numbers only
      Else
      MsgBox "Could not find the data!"
      End If
      Else
      MsgBox "Please enter a correct date as yyyy-mm-dd"
      End If
      MsgBox "The rate for 1 USD in EURO is " & strCSV
      End Sub






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Dec 8 '17 at 14:38









      XabierXabier

      6,6281419




      6,6281419












      • thank you very much! can i calling CryptoQuote as a UDF (user defined function)?

        – Maxim Baran
        Dec 8 '17 at 15:46











      • No problem,.. Of course you can call the Subroutine from other places too, I guess it's probably best if you play with it and see what you are able to do.. Any issues, I will be happy to help. :)

        – Xabier
        Dec 8 '17 at 15:50











      • hi friend, i change my code, thats always return me the date of today.

        – Maxim Baran
        Dec 8 '17 at 16:00











      • If you are going to pass the enteredDate as a string, maybe you should also remove the If IsDate(enteredDate) Then, as it will not be a date, it will be a string instead, also you should do some validation before you call the macro to make sure that the date is formatted correctly... but yeah this should work also...

        – Xabier
        Dec 8 '17 at 16:03











      • thank you.. i removed enteredDate = Format(Date, "yyyy-mm-dd")

        – Maxim Baran
        Dec 8 '17 at 16:13

















      • thank you very much! can i calling CryptoQuote as a UDF (user defined function)?

        – Maxim Baran
        Dec 8 '17 at 15:46











      • No problem,.. Of course you can call the Subroutine from other places too, I guess it's probably best if you play with it and see what you are able to do.. Any issues, I will be happy to help. :)

        – Xabier
        Dec 8 '17 at 15:50











      • hi friend, i change my code, thats always return me the date of today.

        – Maxim Baran
        Dec 8 '17 at 16:00











      • If you are going to pass the enteredDate as a string, maybe you should also remove the If IsDate(enteredDate) Then, as it will not be a date, it will be a string instead, also you should do some validation before you call the macro to make sure that the date is formatted correctly... but yeah this should work also...

        – Xabier
        Dec 8 '17 at 16:03











      • thank you.. i removed enteredDate = Format(Date, "yyyy-mm-dd")

        – Maxim Baran
        Dec 8 '17 at 16:13
















      thank you very much! can i calling CryptoQuote as a UDF (user defined function)?

      – Maxim Baran
      Dec 8 '17 at 15:46





      thank you very much! can i calling CryptoQuote as a UDF (user defined function)?

      – Maxim Baran
      Dec 8 '17 at 15:46













      No problem,.. Of course you can call the Subroutine from other places too, I guess it's probably best if you play with it and see what you are able to do.. Any issues, I will be happy to help. :)

      – Xabier
      Dec 8 '17 at 15:50





      No problem,.. Of course you can call the Subroutine from other places too, I guess it's probably best if you play with it and see what you are able to do.. Any issues, I will be happy to help. :)

      – Xabier
      Dec 8 '17 at 15:50













      hi friend, i change my code, thats always return me the date of today.

      – Maxim Baran
      Dec 8 '17 at 16:00





      hi friend, i change my code, thats always return me the date of today.

      – Maxim Baran
      Dec 8 '17 at 16:00













      If you are going to pass the enteredDate as a string, maybe you should also remove the If IsDate(enteredDate) Then, as it will not be a date, it will be a string instead, also you should do some validation before you call the macro to make sure that the date is formatted correctly... but yeah this should work also...

      – Xabier
      Dec 8 '17 at 16:03





      If you are going to pass the enteredDate as a string, maybe you should also remove the If IsDate(enteredDate) Then, as it will not be a date, it will be a string instead, also you should do some validation before you call the macro to make sure that the date is formatted correctly... but yeah this should work also...

      – Xabier
      Dec 8 '17 at 16:03













      thank you.. i removed enteredDate = Format(Date, "yyyy-mm-dd")

      – Maxim Baran
      Dec 8 '17 at 16:13





      thank you.. i removed enteredDate = Format(Date, "yyyy-mm-dd")

      – Maxim Baran
      Dec 8 '17 at 16:13













      0














      Is this what you want?



      Sub gethtmltable()
      Dim objWeb As QueryTable
      Dim sWebTable As String
      'You have to count down the tables on the URL listed in your query
      'This example shows how to retrieve the 2nd table from the web page.
      sWebTable = 2
      'Sets the url to run the query and the destination in the excel file
      'You can change both to suit your needs

      LValue = Format(Date, "yyyy-mm-dd")
      Set objWeb = ActiveSheet.QueryTables.Add( _
      Connection:="URL;http://www.x-rates.com/historical/?from=USD&amount=1&date=" & LValue, _
      Destination:=Range("A1"))

      With objWeb

      .WebSelectionType = xlSpecifiedTables
      .WebTables = sWebTable
      .Refresh BackgroundQuery:=False
      .SaveData = True
      End With
      Set objWeb = Nothing
      End Sub





      share|improve this answer



























        0














        Is this what you want?



        Sub gethtmltable()
        Dim objWeb As QueryTable
        Dim sWebTable As String
        'You have to count down the tables on the URL listed in your query
        'This example shows how to retrieve the 2nd table from the web page.
        sWebTable = 2
        'Sets the url to run the query and the destination in the excel file
        'You can change both to suit your needs

        LValue = Format(Date, "yyyy-mm-dd")
        Set objWeb = ActiveSheet.QueryTables.Add( _
        Connection:="URL;http://www.x-rates.com/historical/?from=USD&amount=1&date=" & LValue, _
        Destination:=Range("A1"))

        With objWeb

        .WebSelectionType = xlSpecifiedTables
        .WebTables = sWebTable
        .Refresh BackgroundQuery:=False
        .SaveData = True
        End With
        Set objWeb = Nothing
        End Sub





        share|improve this answer

























          0












          0








          0







          Is this what you want?



          Sub gethtmltable()
          Dim objWeb As QueryTable
          Dim sWebTable As String
          'You have to count down the tables on the URL listed in your query
          'This example shows how to retrieve the 2nd table from the web page.
          sWebTable = 2
          'Sets the url to run the query and the destination in the excel file
          'You can change both to suit your needs

          LValue = Format(Date, "yyyy-mm-dd")
          Set objWeb = ActiveSheet.QueryTables.Add( _
          Connection:="URL;http://www.x-rates.com/historical/?from=USD&amount=1&date=" & LValue, _
          Destination:=Range("A1"))

          With objWeb

          .WebSelectionType = xlSpecifiedTables
          .WebTables = sWebTable
          .Refresh BackgroundQuery:=False
          .SaveData = True
          End With
          Set objWeb = Nothing
          End Sub





          share|improve this answer













          Is this what you want?



          Sub gethtmltable()
          Dim objWeb As QueryTable
          Dim sWebTable As String
          'You have to count down the tables on the URL listed in your query
          'This example shows how to retrieve the 2nd table from the web page.
          sWebTable = 2
          'Sets the url to run the query and the destination in the excel file
          'You can change both to suit your needs

          LValue = Format(Date, "yyyy-mm-dd")
          Set objWeb = ActiveSheet.QueryTables.Add( _
          Connection:="URL;http://www.x-rates.com/historical/?from=USD&amount=1&date=" & LValue, _
          Destination:=Range("A1"))

          With objWeb

          .WebSelectionType = xlSpecifiedTables
          .WebTables = sWebTable
          .Refresh BackgroundQuery:=False
          .SaveData = True
          End With
          Set objWeb = Nothing
          End Sub






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 9 '17 at 13:43









          ryguy72ryguy72

          4,4251821




          4,4251821





















              0














              They changed to HTTPS, so make sure that you use https://www.x-rates.com over http://www.x-rates.com. The rest works fine without changes.






              share|improve this answer





























                0














                They changed to HTTPS, so make sure that you use https://www.x-rates.com over http://www.x-rates.com. The rest works fine without changes.






                share|improve this answer



























                  0












                  0








                  0







                  They changed to HTTPS, so make sure that you use https://www.x-rates.com over http://www.x-rates.com. The rest works fine without changes.






                  share|improve this answer















                  They changed to HTTPS, so make sure that you use https://www.x-rates.com over http://www.x-rates.com. The rest works fine without changes.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 15 '18 at 8:42









                  Filnor

                  1,19221724




                  1,19221724










                  answered Nov 15 '18 at 7:10









                  Matus UhrinMatus Uhrin

                  102




                  102



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f47713889%2fexchange-rate-excel%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      這個網誌中的熱門文章

                      What does pagestruct do in Eviews?

                      Dutch intervention in Lombok and Karangasem

                      Channel Islands