Adjust Code from <> X to <> X Or W or Y or Z

CatLadee

New Member
Joined
Sep 7, 2018
Messages
29
Hi all!

Can someone please help me adjust the underlined below to include the equivalent of

<>"200 - OK"
or "301 - Moved Permanently"or "302 - Moved Temporarily"
or "302 - Found"
Then

Thanks so much for your time! - The CatLadee:)

-----


Code:
Sub ValidateURLs()

    Dim Cell As Range
    Dim Rng As Range
    Dim RngEnd As Range
    Dim Status As String
    Dim Wks As Worksheet
    
        Set Wks = ActiveSheet
        Set Rng = Wks.Range("F2")
        
     Set RngEnd = Wks.Cells(Rows.Count, Rng.Column).End(xlUp)
        If RngEnd.Row < Rng.Row Then Exit Sub Else Set Rng = Wks.Range(Rng, RngEnd)
        
            For Each Cell In Rng
                Status = GetURLStatus(Cell)
               [U] If Status <> "200 - OK" Then[/U]
                    Cell.Offset(0, 4) = Status
                End If
            Next Cell

End Sub
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Are you saying that you are checking for "Status" not equal to ANY of those options?
If so, it would look like:
Code:
If (Status <> "200 - OK") And (Status <> [COLOR=#333333]"301 - Moved Permanently"[/COLOR])  And (Status <> [COLOR=#333333]"302 - Moved Temporarily") And (Status <> [/COLOR][COLOR=#333333]"302 - Found") Then[/COLOR]
 
Upvote 0
Joe - thank you very much for your input. That's exactly what I needed. I appreciate you!
 
Upvote 0
You are welcome.
Glad I was able to help.:)
 
Upvote 0

Forum statistics

Threads
1,215,071
Messages
6,122,964
Members
449,094
Latest member
Anshu121

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