Code:
Sub GetRaces2()
Sheets("RaceList").Select
Sheets("RaceList").Range("A2:AB500").Select
Selection.ClearContents
Sheets("Races2").Select
Sheets("Races2").Cells.Select
Selection.ClearContents
With Sheets("Races2").QueryTables.Add(Connection:= _
"URL;http://formguide.cyberhorse.com.au/index.php/Form/view-form.html" _
, Destination:=Sheets("Races2").Range("$A$1"))
.Name = False
.FieldNames = False
.RowNumbers = False
.FillAdjacentFormulas = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.Refresh BackgroundQuery:=False
End With
A = 2
B = 2
strquote = Chr$(34)
TrackName = vbNullString
RaceNumber = 0
Do While Sheets("Races2").Cells(A, 1) <> vbNullString Or Sheets("Races2").Cells(A + 1, 1) <> vbNullString
If IsNumeric(Sheets("Races2").Cells(A, 1)) = False Then
TrackName = Sheets("Races2").Cells(A, 1)
If TrackName = "Port Macquarie" Then TrackName = "Pt Macquarie"
A = A + 2
End If
If IsNumeric(Sheets("Races2").Cells(A, 1)) = True Then
RaceNumber = Sheets("Races2").Cells(A, 1)
Sheets("RaceList").Cells(B, 1) = TrackName
Sheets("RaceList").Cells(B, 2) = RaceNumber
Sheets("RaceList").Cells(B, 3) = "=GetAddress(Races2!E" & A & ")"
Sheets("RaceList").Cells(B, 4) = "=SUBSTITUTE(C" & B & "," & strquote & "&" & strquote & "," & strquote & "&&" & strquote & ")"
Sheets("RaceList").Cells(B, 4) = "http://" & "formguide.cyberhorse.com.au/index.php/Form/form.html?" & Right(Sheets("RaceList").Cells(B, 4), Len(Sheets("RaceList").Cells(B, 4)) - 80)
Sheets("RaceList").Cells(B, 5) = "'" & Mid(Sheets("RaceList").Cells(B, 4), 70, 10)
A = A + 1
B = B + 1
End If
Loop
RaceCount = B - 1
End Sub
My vba is limited but i can see where the problem is, in the above code if all we need is the address can't we just use what is outputted in column C