Hyperlink for Picture Icon

jstevens
GoldLounger
Posts: 2628
Joined: 26 Jan 2010, 16:31
Location: Southern California

Hyperlink for Picture Icon

Post by jstevens »

I utilize this bit of code to determine the number of picture icons in a cell. In this example Cell J2 has three icons each having a different hyperlink.

What I would like to do is generate a list of the three hyperlinks.

Code: Select all

Sub countRangeImg()
Cnt = 0
For Each shp In ActiveSheet.Shapes

    If Not Application.Intersect(Range("J2:J2"), shp.TopLeftCell) Is Nothing Then
        Cnt = Cnt + 1
    End If
Next
MsgBox Cnt
End Sub
Regards,
John

jstevens
GoldLounger
Posts: 2628
Joined: 26 Jan 2010, 16:31
Location: Southern California

Re: Hyperlink for Picture Icon

Post by jstevens »

I was able to generate the hyperlink list with the following modification: Cells(2, 12 + Cnt) = shp.Hyperlink.Address

Code: Select all

Sub countRangeImg()
Cnt = 0
For Each shp In ActiveSheet.Shapes

    If Not Application.Intersect(Range("J2:J2"), shp.TopLeftCell) Is Nothing Then
        Cells(2, 12 + Cnt) = shp.Hyperlink.Address    'Generates hyperlink list
        Cnt = Cnt + 1
    End If
Next
MsgBox Cnt
End Sub
Regards,
John

User avatar
StuartR
Administrator
Posts: 12604
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Hyperlink for Picture Icon

Post by StuartR »

Thank you for sharing your solution
StuartR