Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This is the macro code i'm using to import data from YAHOO into excel
The only thing I need is to be able to run the macro everytime I pres ENTER in any of these 5 boxes (C3, F3, I3, L3, O3) How do I do that? Thanks and any help is appreciated. Sub Stock1() ' ' macro1 Macro ' Macro recorded 2/26/2004 by Fongsaiyuk ' Dim CoSym As String CoSym = Worksheets("Main").Range("C3").Value With Sheets("Stock 1").QueryTables(1) .Connection = _ "URL;http://table.finance.yahoo.com/d?a=1...&f=2004&g=d&s= & CoSym .WebSelectionType = xlEntirePage .WebFormatting = xlWebFormattingAll .WebPreFormattedTextToColumns = True .WebConsecutiveDelimitersAsOne = True .WebSingleBlockTextImport = True .WebDisableDateRecognition = False .WebDisableRedirections = True .Refresh BackgroundQuery:=False End With End Sub Sub Stock2() ' ' macro1 Macro ' Macro recorded 2/26/2004 by Fongsaiyuk ' Dim CoSym As String CoSym = Worksheets("Main").Range("F3").Value With Sheets("Stock 2").QueryTables(1) .Connection = _ "URL;http://table.finance.yahoo.com/d?a=1...&f=2004&g=d&s= & CoSym .WebSelectionType = xlEntirePage .WebFormatting = xlWebFormattingAll .WebPreFormattedTextToColumns = True .WebConsecutiveDelimitersAsOne = True .WebSingleBlockTextImport = True .WebDisableDateRecognition = False .WebDisableRedirections = True .Refresh BackgroundQuery:=False End With End Sub Sub Stock3() ' ' Stock3 Macro ' Macro recorded 2/26/2004 by Fongsaiyuk ' Dim CoSym As String CoSym = Worksheets("Main").Range("I3").Value With Sheets("Stock 3").QueryTables(1) .Connection = _ "URL;http://table.finance.yahoo.com/d?a=1...&f=2004&g=d&s= & CoSym .WebSelectionType = xlEntirePage .WebFormatting = xlWebFormattingAll .WebPreFormattedTextToColumns = True .WebConsecutiveDelimitersAsOne = True .WebSingleBlockTextImport = True .WebDisableDateRecognition = False .WebDisableRedirections = True .Refresh BackgroundQuery:=False End With End Sub Sub Stock4() ' ' macro1 Macro ' Macro recorded 2/26/2004 by Fongsaiyuk ' Dim CoSym As String CoSym = Worksheets("Main").Range("L3").Value With Sheets("Stock 4").QueryTables(1) .Connection = _ "URL;http://table.finance.yahoo.com/d?a=1...&f=2004&g=d&s= & CoSym .WebSelectionType = xlEntirePage .WebFormatting = xlWebFormattingAll .WebPreFormattedTextToColumns = True .WebConsecutiveDelimitersAsOne = True .WebSingleBlockTextImport = True .WebDisableDateRecognition = False .WebDisableRedirections = True .Refresh BackgroundQuery:=False End With End Sub Sub Stock5() ' ' macro1 Macro ' Macro recorded 2/26/2004 by Fongsaiyuk ' Dim CoSym As String CoSym = Worksheets("Main").Range("O3").Value With Sheets("Stock 5").QueryTables(1) .Connection = _ "URL;http://table.finance.yahoo.com/d?a=1...&f=2004&g=d&s= & CoSym .WebSelectionType = xlEntirePage .WebFormatting = xlWebFormattingAll .WebPreFormattedTextToColumns = True .WebConsecutiveDelimitersAsOne = True .WebSingleBlockTextImport = True .WebDisableDateRecognition = False .WebDisableRedirections = True .Refresh BackgroundQuery:=False End With End Su -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |