For me this worked, but I have to admit, I deleted the rows below 150, because it takes about 45 seconds to complete to row 150, just for getting the data from internet, for only 10 rows.....
With the first macro I turned background updating of the other cells off, I did this before executing the main procedure.
Of course you have to update once in a while.....
Sub Stop_Updating()
Dim i
For i = 3 To 150
If Cells(i, 4) <> "" Then
Cells(i, 4).QueryTable.BackgroundQuery = False
End If
Next i
End Sub
Sub importwiseowlcourses()
Dim ws As Worksheet
Dim qt As QueryTable
Dim URL As String
Dim Rng01 As Range
Dim Rng02 As Range
Dim i01 As Long
Set Rng01 = Cells(3, 1)
Call Functions_Module.BlanksToSkip(Rng01, "Down", Rng02, 1)
For i01 = 140 To Rng02.Row - Rng01.Row - 1
'URL = "http://www.wiseowl.co.uk/courses/"
'URL = "https://www.linkedin.com/salary/Project-Engineer-salaries-in-australia"
'Set ws = Worksheets.Add
'Set qt = ws.QueryTables.Add(Connection:="URL;" & URL, Destination:=Range("A1"))
URL = Cells(2 + i01, 2)
Set Rng01 = Cells(2 + i01, 4)
Set qt = ActiveSheet.QueryTables.Add(Connection:="URL;" & URL, Destination:=Rng01)
Application.ScreenUpdating = False
With qt
' .RefreshOnFileOpen = True
' .RefreshPeriod = 5 ' (5 = 5 minutes, 0 will not refresh automatically)
' .Name = "OWLCourses"
' .WebFormatting = xlWebFormattingRTF
.WebSelectionType = xlEntirePage
' .WebTables = "3"
' .WebTables = "1,2"
.BackgroundQuery = False
.Refresh
End With
' Application.Wait (Now + TimeValue("0:00:05"))
' Cells(2 + i01, 4).Copy 'I deselected those rows)
' Cells(2 + i01, 4).PasteSpecial Paste:=xlPasteValues
Next i01
Application.ScreenUpdating = True
MsgBox ("ready")
End Sub
B/R
Erwin
Bookmarks