Ինչպե՞ս լրացնել Google- ի որոնման արդյունքները Excel- ում աշխատաթերթ:
Որոշ դեպքերում կարող է անհրաժեշտ լինել Google- ում կատարել մի քանի կարևոր բառի որոնում և որոնման արդյունքների վերին գրառումն ունենալ աշխատանքային թերթում, որը ներառում է հոդվածի վերնագիրն ու գերհղումը: Այս հոդվածը տրամադրում է VBA մեթոդ, որն օգնում է Google- ի որոնման արդյունքները լրացնել աշխատանքային թերթում, որը հիմնված է բջիջներում տրված հիմնաբառերի վրա:
Google- ի որոնման արդյունքները լրացրեք VBA կոդով աշխատաթերթում
Google- ի որոնման արդյունքները լրացրեք VBA կոդով աշխատաթերթում
Ենթադրելով, որ հիմնաբառերը, որոնք անհրաժեշտ է որոնել ցուցակում A սյունակում, ինչպես ցույց է տրված ստորև նշված էկրանի նկարը, խնդրում ենք կատարել հետևյալը ՝ այս հիմնաբառերի google որոնման արդյունքները լրացնելու համար VBA կոդով համապատասխան սյունակներում:
1. Սեղմեք ալտ + F11 բացել ստեղները Microsoft Visual Basic հավելվածների համար պատուհան.
2. Մեջ Microsoft Visual Basic հավելվածների համար պատուհանը, սեղմեք Տեղադրել > Մոդուլներ, Դրանից հետո պատճենեք և տեղադրեք VBA կոդը ծածկագրի պատուհանում:
VBA կոդ. Լրացրեք google որոնման արդյունքները աշխատաթերթում
Sub xmlHttp()
'Updated by Extendoffice 2018/1/30
Dim xRg As Range
Dim url As String
Dim xRtnStr As String
Dim I As Long, xLastRow As Long
Dim xmlHttp As Object, xHtml As Object, xHtmlLink As Object
On Error Resume Next
Set xRg = Application.InputBox("Please select the keywords you will search in Google:", "KuTools for Excel", Selection.Address, , , , , 8)
If xRg Is Nothing Then Exit Sub
Application.ScreenUpdating = False
xLastRow = xRg.Rows.Count
Set xRg = xRg(1)
For I = 0 To xLastRow - 1
url = "https://www.google.co.in/search?q=" & xRg.Offset(I) & "&rnd=" & WorksheetFunction.RandBetween(1, 10000)
Set xmlHttp = CreateObject("MSXML2.serverXMLHTTP")
xmlHttp.Open "GET", url, False
xmlHttp.setRequestHeader "Content-Type", "text/xml"
xmlHttp.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1; rv:25.0) Gecko/20100101 Firefox/25.0"
xmlHttp.send
Set xHtml = CreateObject("htmlfile")
xHtml.body.innerHTML = xmlHttp.ResponseText
Set xHtmlLink = xHtml.getelementbyid("rso").getelementsbytagname("H3")(0).getelementsbytagname("a")(0)
xRtnStr = Replace(xHtmlLink.innerHTML, "<EM>", "")
xRtnStr = Replace(xRtnStr, "</EM>", "")
xRg.Offset(I, 1).Value = xRtnStr
xRg.Offset(I, 2).Value = xHtmlLink.href
Next
Application.ScreenUpdating = True
End Sub
3. Press the F5 key to run the code. In the popping up Kutools for Excel dialog box, please select the cells containing keywords you will search, and then click the OK button. See screenshot:

Then all search results including titles and links are populated into corresponding column cells based on keywords. See screenshot:

Related articles:
- How to populate a combo box with specified data on Workbook open?
- How to auto populate other cells when selecting values in Excel drop down list?
- How to auto populate other cells when selecting values in Excel drop down list?
The Best Office Productivity Tools
Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%
- Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
- Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
- Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
- Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
- Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
- Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
- Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
- Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
- More than 300 powerful features. Supports Office / Excel 2007-2021 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Sort comments by
#28233
This comment was minimized by the moderator on the site
Report
0
0
#28234
This comment was minimized by the moderator on the site
0
0
#29011
This comment was minimized by the moderator on the site
0
0
#30491
This comment was minimized by the moderator on the site
0
0
#30492
This comment was minimized by the moderator on the site
Report
0
0
#30493
This comment was minimized by the moderator on the site
0
0
There are no comments posted here yet