Thread: Excel Help
View Single Post
  #3  
Old 29th May 2009, 04:20 PM
Shaun Shaun is offline
Member
 
Join Date: Jan 1970
Location: Western Australia
Posts: 3,456
Default

Ok i have worked out how to link it to a cell now i am trying to get it to work on a calculation event so it will run automatic.

Code:
Private Sub Worksheet_Calculate() Static MyMarket As Variant Application.EnableEvents = False Application.Calculation = xlCalculationManual If [A1].Value = MyMarket Then GoTo Xit Else MyMarket = [A1].Value With ActiveSheet.QueryTables.Add(Connection:="URL;" & Range("B1").Value, Destination:=Range("D1")) .Name = "betting.asp?eventid=275684" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlOverwriteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .WebSelectionType = xlSpecifiedTables .WebFormatting = xlWebFormattingNone .WebTables = """HorseTable""" .WebPreFormattedTextToColumns = True .WebConsecutiveDelimitersAsOne = True .WebSingleBlockTextImport = False .WebDisableDateRecognition = False .WebDisableRedirections = False .Refresh BackgroundQuery:=False End With End If Xit: Application.EnableEvents = True Application.Calculation = xlCalculationAutomatic End Sub
Reply With Quote