• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to read and print some links from some named hyperlinks

shahin

Active Member
I'm trying to develop a macro which should read the cells (Column B in the attached image) connected to different links and print them in immediate window. When I execute what I've created so far, I get "subscript out of range" error.

Code:
Sub PrintURL()
    Dim cel As Range
    For Each cel In Range("B1:B3")
        Debug.Print cel.Hyperlinks(1).Address
    Next cel
End Sub

I used this formula `=HYPERLINK()` to create those named hyperlinks in Column B.

The links in Column A are the placeholders as they may be anywhere. I only showed them to let you know what are within "so","yahoo" and "bing".

Please refer to the image attached which represents how the spreadsheet looks like.

This is where a cross-post https://stackoverflow.com/questions...d-print-some-links-from-some-named-hyperlinks in place.
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    15.8 KB · Views: 7
Without forgetting the basis - again ! - you can't raise this error just checking the number of elements from any collection (object),​
and as a 'formula hyperlink' is not a VBA Hyperlink object …​
 
Back
Top