+ Reply to Thread
Results 1 to 2 of 2

Dynamic web query from cell values

  1. #1
    Registered User
    Join Date
    05-14-2015
    Location
    Kent
    MS-Off Ver
    365
    Posts
    20

    Dynamic web query from cell values

    Evening,
    I must be doing something really wrong with the code as itsnot working for me to change the fields of Location, Date before downloading aQuery from website. I have shared the sheet in Google Drive if somebody canhelp please?

    http://www.realtimetrains.co.uk/sear...=all&order=wtt

    Mainsheet highlighted in YELLOW connected with above red

    https://drive.google.com/file/d/16ZN...ew?usp=sharing

    Sub Macro1()


    Dim locstr As String
    Dim yearstr As String
    Dim daystr As String
    Dim monthstr As String


    locstr = Sheets("Sheet2").Range("A1").Value
    yearstr = Sheets("Sheet2").Range("A2").Value
    daystr = Sheets("Sheet2").Range("A3").Value
    monthstr = Sheets("Sheet2").Range("A4").Value


    With ActiveSheet.QueryTables(1)
    .Connection = "URL;http://www.realtimetrains.co.uk/search/advanced/" & locstr & "/" & yearstr & "/" & daystr & "/" & monthstr & "/0000-2359?stp=WVS&show=all&order=wtt"
    .Refresh
    End With


    End Sub

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,619

    Re: Dynamic web query from cell values

    Administrative Note:

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Populate Dynamic Array from Cell Values and write to Dynamic Range
    By TFiske in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-22-2018, 09:09 AM
  2. Web Query with dynamic URL, parameter based on cell value
    By Graham W in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-23-2017, 02:16 PM
  3. Dynamic Web Query that References a Cell Value
    By chance.d in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-18-2013, 12:31 PM
  4. [SOLVED] Access ADO - SQL query (3 cell values)
    By Dan17602 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-29-2012, 02:04 PM
  5. Web query with dynamic parameter picked up from cell values
    By naqviimran in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2011, 01:10 AM
  6. Manipulate dynamic rows values and dynamic columns values
    By excel_vb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-22-2010, 09:22 PM
  7. Dynamic Web Query Using Values In Cell
    By Amrit in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-28-2009, 08:07 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1