Tonmoymridha
New Member
- Joined
- Nov 18, 2019
- Messages
- 12
this code shows error 1004 on my office 2021 but its work fine on office 365 , can you help me out anyone?
VBA Code:
Function TEN_RACE_CREATION1()
Dim url As String
Dim table As QueryTable
Dim ws As Worksheet
Dim lastRow As Long
Sheets("Meeting Results").Activate
Sheets("Meeting Results").Columns("A:Q").Delete Shift:=xlToLeft
Sheets("Meeting Results").Range("A1").Select
url = "https://www.racingaustralia.horse/FreeFields/Results.aspx?Key=" & Sheets("Track_Tables").Range("G43").Value
Set ws = Sheets("Meeting Results") ' Change the sheet reference as per your requirement
lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + 1
Set table = ws.QueryTables.Add("URL;" & url, ws.Cells(lastRow, "A"))
With table
.WebSelectionType = xlAllTables ' Collect data from all tables on the web page
.WebFormatting = xlWebFormattingRTF
.Refresh
End With
End Function