Web Query with a cell reference in the URL

janamuz

New Member
Joined
Sep 17, 2014
Messages
1
I am trying to get a macro to run and grab some weather data from a website. I need it to look ahead in time several hours. Here is what I have been trying but no luck in getting this to work. In the URL it calls out AheadHour= and that is where I am trying to insert the cell with the time I need it to look ahead.

With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://forecast.weather.gov/MapClick.php?w0=t&w3u=1&w6=rh&w10u=0&w13u=1&w14u=1&AheadHour=" & Sheets("TEMPS").Range("FirstTime").Value & "Submit=Submit&FcstType=digital&textField1=33.43742&textField2=-112.85199&site=all&unit=0&dd=&bw=" _
, Destination:=Range("$A$4"))
.Name = _
"MapClick.php?w0=t&w3u=1&w6=rh&w10u=0&w13u=1&w14u=1&AheadHour=9&Submit=Submit&FcstType=digital&textField1=33.43742&textField2=-112.85199&site=all&unit=0&dd=&bw="
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "8"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,215,744
Messages
6,126,623
Members
449,322
Latest member
Ricardo Souza

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