Microsoft Excel 2010

Closed
trouble in Texas - Feb 22, 2012 at 11:07 AM
RWomanizer
Posts
365
Registration date
Monday February 7, 2011
Status
Contributor
Last seen
September 30, 2013
- Feb 29, 2012 at 12:43 AM
Hello,
I would like to figure out how to get a web address that I use to get data from the internet to always use the date that I put in cell A1. Any suggestions? Thanks.



2 replies

RWomanizer
Posts
365
Registration date
Monday February 7, 2011
Status
Contributor
Last seen
September 30, 2013
120
Feb 23, 2012 at 05:57 AM
paste some sort of data here and re-explain your problem
0
trouble in Texas
Feb 23, 2012 at 08:39 AM
Sub Macro1()
'
' Macro1 Macro
'

'
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.wunderground.com/history/airport/KCAO/2012/2/22/DailyHistory.html?req_city=Clayton&req_state=NM&req_statename=New+Mexico&format=1" _
, Destination:=Range("$C$17"))
.Name = _
"DailyHistory.html?req_city=Clayton&req_state=NM&req_statename=New+Mexico&format=1_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.We
bSelectionType = xlEntirePage

.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub

Here's the macro I put together. I need the date (2012/2/22) in the web address to = the date in A1.
Do you see what I'm after now? Thanks.
0
RWomanizer
Posts
365
Registration date
Monday February 7, 2011
Status
Contributor
Last seen
September 30, 2013
120
Feb 29, 2012 at 12:43 AM
replace this line
"URL;https://www.wunderground.com/?cm_ven=cgi 


by

"URL;https://www.wunderground.com/?cm_ven=cgi"&year(range("A1")&"/" &month(range("A1")&"/"&day(range("A1")&"2012/2/22/DailyHistory.html? 



hope it will solve your problem
0