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

tonywatsonhelp

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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Watch MrExcel Video

Forum statistics

Threads
1,109,428
Messages
5,528,698
Members
409,830
Latest member
KT50

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top