VBA to say yes if a website header has a particular word in it?

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
2,593
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Guys,

ok so I have a macro that opens up a list of websites one by one for me to inspect.
a lot of the sites I'm looking for have the word "Real Estate" in the header, or the tab at the top of the page, (I'm not sure the technical word for it, but as you load the page the tab show data, this often has the word real estate in it,

so I was wondering if there was a way to get the vba code to look for that word in the header (or whatever its called) and if its there automatically answer yes and no to my macro instead of me having to do t manually?

This is the macro I currently use the part that says call macro1 this is just a macro to close the internet Explorer otherwise I end up with loads of tabs open.

anyway, if anyone can help me it would be a great help.

here's the code I currently use to open the websites one at a time, so instead of it asking me if its a good site, I'd like it to make up its own mind depending on if the header has real estate in it or not.

Code:
Sub Start()
Dim ans
Dim one
one = 2
one = InputBox("What row do you want to start on", "Hello", "2")
'If you click on the Cancel button it will stop the script
Lastrow = Range("A1").End(xlDown).Row
For I = one To Lastrow
On Error Resume Next
    Cells(I, 1).Select
    Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
    Msg = "Is This A Good Site ? "
        
        ans = MsgBox(Msg, vbQuestion + vbYesNoCancel)
        If ans = vbYes Then
        Call Macro1
        Cells(I, 2) = "Good site"
        ActiveWorkbook.save
        End If
        If ans = vbNo Then
        Call Macro1
                Cells(I, 3) = "bad"
        
        ActiveWorkbook.save
        End If
        If ans = vbCancel Then Exit Sub
     
        
        
        Next
        one = ""
        
        
        
        End Sub

thanks

Tony
 

Some videos you may like

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Watch MrExcel Video

Forum statistics

Threads
1,114,322
Messages
5,547,243
Members
410,781
Latest member
fabalshehhi
Top