I have a snippet of vba that should change the background colour of an auto generated hyperlink when the link is clicked (and doesn't produce an error
This is what should happen
Is this a link?
No? Ignore. Yes? Carry on
Does this link go anywhere?
No? Change background colour. Yes? Carry on
Repeat for every selected link
My code is as such:
Sub Click_Links()
Dim links As Hyperlink
Dim rng As Range
Set rng = Range("Range1")
' i = 0
On Error Resume Next
' n = 1 / i
If Err.Number <> 0 Then
'If there are no errors'
links.Parent.Interior.Color = 100
'Change bg colour'
' On Error Resume Next
Else
On Error GoTo 0
For Each links In rng.Hyperlinks
'Every Line'
links.Follow
'Click the link'
Next links
'Go to next link to check'
End If
End Sub
When I run the script, nothing happens except the screen flickers. While messing with the code, I had issues with the End If
but it basically magically dissapeared? before THAT, the script ran, changed one background colour and then stopped working straight after
Any help would be greatly appreciated!
Thank you