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

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
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
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,214,812
Messages
6,121,704
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top