Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Change Server for Query | Excel Discussion (Misc queries) | |||
How to change MS Query via VBA | Excel Programming | |||
Database change in Query | Excel Discussion (Misc queries) | |||
How to change an existing query | Excel Discussion (Misc queries) | |||
can't change field name in query? | Links and Linking in Excel |