Macro to open a website from a list in excel ask me if its what i'm looking for then add yes or no next to the web address in excel?

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,210
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi everyone,
OK I've got a big challenge for you all now,
I have a list of websites in column A of a spreadsheet, the number of website will vary as I have lot of sheets to go through, however what I want to do is open each site to see if its the type of website I'm looking for and put a yes or no next to each site.
so I'm looking for a macro that can start at A2 open up the web address in A2, then ask me "is this what you are looking for? I answer yes or no and the answer gets put into the excel document in column B next to the website (B2), we then move on to cell A3 and do the same thing and carry on until I've done all web sites in my list.
Does anyone know if this would be possible? if so,
how I could do it?
I'm on office 2013 and in have internet explorer and chrome loaded if that helps.

I know this might be to big a question for someone to answer on here but I was hopping maybe somebody would know how to do it?
here is a snippet of the websites if you need to test anything:
[TABLE="width: 656"]
<COLGROUP><COL style="WIDTH: 656pt; mso-width-source: userset; mso-width-alt: 32000" width=875><TBODY>[TR]
[TD="class: xl64, width: 875, bgcolor: transparent"]http://www.alcscapital.com/[/TD]
[/TR]
[TR]
[TD="class: xl64, bgcolor: transparent"]http://www.vanessapollock.com/[/TD]
[/TR]
[TR]
[TD="class: xl64, bgcolor: transparent"]http://www.propertyexhibit.com/[/TD]
[/TR]
[TR]
[TD="class: xl64, bgcolor: transparent"]http://www.bergenhomeinfo.com/[/TD]
[/TR]
[TR]
[TD="class: xl64, bgcolor: transparent"]http://www.azteccontainer.com/[/TD]
[/TR]
[TR]
[TD="class: xl64, bgcolor: transparent"]http://www.islandappraisal.com/[/TD]
[/TR]
</TBODY>[/TABLE]
I could really do with help on this?

Thanks

Tony
 
Tony. Here is the modified script. I think putting in a save command may be dangerous. If your sure you want that let me know and I will send you modified three.

Code:
Sub Start()
Dim ans
Dim one
one = 2

one = InputBox("What row do you want to start on", "Hello", "1")
'If you click on the Cancel button it will stop the script
Lastrow = Range("A1").End(xlDown).Row
For i = one To Lastrow
    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
        Cells(i, 2) = "Good site"
        End If
        If ans = vbNo Then
        End If
        If ans = vbCancel Then Exit Sub
        Next
        one = ""
        
        
        
        End Sub
 
Upvote 0

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Tony.
One more quick note. On the newest version if you want to stop the script then click the cancel button.
 
Upvote 0
Hi Mate,
I'm thinking if it saves every time it does the command, it doesn't matter when, for example it could save everytime I answer yes or no! that would be perfect.
and I do understand your concern about the save command, however I will be save each document at the very start with a new name into a new folder, I also have a back up copy of all the data I'm working on so if something went wrong id have backups to call on,
I think the worry about it saving when I don't want it to is of much less concern to me than my computer crashing after its done 1,000 lines of data and me having to start again, I know there is autosave but a lot can change in a file a 5 minutes, I would just be happier if this was possible.
 
Upvote 0
Hi Mate,
I have been using your latest macro, and it works great,
just one problem,
if it can't find the website (it could be the webaddress is invalid or incomplete) but whatever the reason, if it cant open the website I get an error message that it can't find server, and the whole thing stops, now if it can't open the website then its not a good site, this could be an auto "no" and move on to next one!
I know its a big ask but can you think of a way to do this?
thanks
Tony
 
Upvote 0
Tony. I will work on both of your request and will get back with you. I like tinkering with code :)
 
Upvote 0
ok cool,
if I'm being honest, I literally just solved the "save" problem so no need to worry about that. but thanks again for your help.
Tony
 
Upvote 0
</SPAN>Tony.
I have modified the script to handle the error problem and a couple other minor changes you will notice. When you encounter a bad link and the prompt ask “Was this a good site select the “No” button and that line will be flagged. When you select the “Cancel Button” the script will now flag the row you stopped on. I have researched and found it's impossible to have a script automatically "Save" while the script is running. I hope this helps you.
Code:
Sub Start()
Dim ans
Dim one
one = 2

one = InputBox("What row do you want to start on", "Hello", "1")
'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
        Cells(i, 2) = "Good site"
        End If
        If ans = vbNo Then
        Cells(i, 2) = "Bad Link"
        End If
        If ans = vbCancel Then
        Cells(i, 2) = "Stopped on Row  " & i
        
        Exit Sub
        End If
        
        
        Next
        one = ""
        
        
        
        End Sub
</SPAN>
 
Upvote 0
Tony
If you have found a way to have the script "Save" while running I would like to see that for further reference.
 
Upvote 0
Tony.
Maybe I should have asked the question earlier. Are you actually looking at the screen and determining if you like this site? Or are you just trying to see if this is a good link. I was under the impression you were wanting to look at the site and see if you like what you see and not if this is a good link. Wishing you a good day. It's been fun working with you.
 
Upvote 0
Hi My Answer Is This,
I just wanted you to know I've been using your code all day today and the fix to stop it crashing when the website wont open is excellent.
Everything you did was fantastic, I just wanted to say a huge thank you for your help, I would have been so lost without you, and Judging by the way nobody else answered, I'd say that was a truly skilled piece of code so thank you very much.

Don't suppose you could help with my user form problem could you?

Tony
 
Upvote 0

Forum statistics

Threads
1,223,098
Messages
6,170,106
Members
452,302
Latest member
TaMere

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