D
David
Hi Group,
I have a query:
Sub Macro3()
Range("C1").Select 'Range C1 Has a date ie 5/27/2009
ThisDate = ActiveCell.Value
ThisMonth = Month(ThisDate)
ThisDay = Day(ThisDate)
ThisYear = Year(ThisDate)
ActiveCell.Offset(1, 0).Select
z = ActiveCell.Offset(0, -2).Value 'This get a ticker symbol ie AA
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://table.finance.yahoo.com/table.csv?a=0&b=" & (ThisMonth) &
"&c=" _
& (ThisYear) & "&d=" & (ThisMonth) & "&e=" _
& ThisDay & "&f=" & ThisYear _
& "&y=0&g=w&s=" & z, Destination:=Range(ActiveCell.Address))
.WebSelectionType = xlSpecifiedTables
.WebTables = "20"
.Refresh BackgroundQuery:=False
End With
End Sub
C1 has a date in it ie 5/27/2009, Z capture a Ticker Symbol from cell A2.
I was using this in another macro and capturing Weekly data. I need to
change it so that it only capture one day. In this example 5/27/2009, but I
need to do this with the variables, since the day will change often, ThisDay,
ThisMonth and This Year.
Thank you for your help,
David
I have a query:
Sub Macro3()
Range("C1").Select 'Range C1 Has a date ie 5/27/2009
ThisDate = ActiveCell.Value
ThisMonth = Month(ThisDate)
ThisDay = Day(ThisDate)
ThisYear = Year(ThisDate)
ActiveCell.Offset(1, 0).Select
z = ActiveCell.Offset(0, -2).Value 'This get a ticker symbol ie AA
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://table.finance.yahoo.com/table.csv?a=0&b=" & (ThisMonth) &
"&c=" _
& (ThisYear) & "&d=" & (ThisMonth) & "&e=" _
& ThisDay & "&f=" & ThisYear _
& "&y=0&g=w&s=" & z, Destination:=Range(ActiveCell.Address))
.WebSelectionType = xlSpecifiedTables
.WebTables = "20"
.Refresh BackgroundQuery:=False
End With
End Sub
C1 has a date in it ie 5/27/2009, Z capture a Ticker Symbol from cell A2.
I was using this in another macro and capturing Weekly data. I need to
change it so that it only capture one day. In this example 5/27/2009, but I
need to do this with the variables, since the day will change often, ThisDay,
ThisMonth and This Year.
Thank you for your help,
David