Macro eror help ?

Copper Contributor

Can u help me to fix these 

 

'Google Search using VBA
Sub SearchGoogle()
Dim objIE As Object
Dim lngMaxRows As Long
Dim lngCtr As Long
Dim strSearchValue As String
Dim objResults As Object

'Get the Maximum number of rows in Col A, that has data
lngMaxRows = Cells(Rows.Count, 1).End(xlUp).Row

'Loop through till the maximum row and search for the value in each row
For lngCtr = 2 To lngMaxRows

Set objIE = CreateObject("InternetExplorer.Application")

'Get the search value from the current row in Column A
strSearchValue = Cells(lngCtr, 1).Value

Application.StatusBar = "Searching for keyword: '" & _
strSearchValue & "'"

With objIE
'Keep the Internet Explorer Closed.
'Set .Visible = True, if you want IE to remain opened.
.Visible = False

'Navigate to the search value
.navigate "http://www.google.com/search?q=" & strSearchValue

'Wait some to time for loading the page
While .Busy
DoEvents
Wend

'Wait for another 2 seconds, just in case the page hasn't yet loaded
Application.Wait (Now + TimeValue("0:00:02"))

'Get the search results
Set objResults = .document.getElementById("resultStats")

'Fill up the corresponding Search Result column
Cells(lngCtr, 2).Value = objResults.innerText

'Close the Internet Explorer
.Quit
End With

'Destroy the object
Set objIE = Nothing
Next lngCtr

Application.StatusBar = False

'Display message, when complete
MsgBox "Google Search Complete!!!"
End Sub\

0 Replies