Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Excel VBA Multi-Hyperlinks in cell workaround

Excel VBA Multi-Hyperlinks in cell workaround

Excel VBA Multi-Hyperlinks in cell workaround

I'm trying to find all hyperlink strings surrounded by parentheses "(" & ")" in my active sheet and perform two functions.

Function 1 is to delete the parentheses when a hyperlink string is within them (https://...). It must avoid parentheses that do not contain hyperlinks as they may contain necessary text notes.
Function 2 is to insert a PNG icon (Download link.png) to the left of the hyperlink string that is click-able and will open the relevant hyperlink.

Here is a thread where someone got a similar VBA script to work:

I'm having trouble modifying it to suit my needs. Could someone give this a shot and help me out?
Any help would be much appreciated.

RE: Excel VBA Multi-Hyperlinks in cell workaround


What code have you tried?

What error message or result did you get?

Can you post a representative sample of the data in your sheet, or upload?

BTW, you never responded to the cell merge issue that you posted earlier this month.


glassesJust traded in my OLD subtlety...
for a NUance!tongue

"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein

RE: Excel VBA Multi-Hyperlinks in cell workaround

Hi Skip,

Thanks for chiming in.

For now I am using the function at this link exactly:
I don't know where to start modifying without breaking it.

For the line "ActiveSheet.Pictures.Insert(picpath).Select" I'm getting the error "Unable to get the Insert property of the Pictures class." I've attached a representative sheet to this post showing what I'm aiming to resolve.

Regarding the Cell Merge issue, thank you for the code you provided for that. Unfortunately after testing I saw what you meant, that Autofit will not work in merged cells. So I have put that issue on the backburner.

Any advice you have regarding this issue would be a huge help. Thx

RE: Excel VBA Multi-Hyperlinks in cell workaround

Excel is not a word processor, so some functionalities are not available.
The simplest part: with InStr VBA function you can find required characters ("(" and ")") within the text, Mid function will return required part of the string. You need an algorithm to verify, if the string found has proper address syntax.
The picture added is in the drawing layer, above the grid. If you remove the web address, you need to put some spaces to have room for image th the drawing layer.
You may have problem with locating address coordinates within the cell, there is no direct data for character - you plan to put image here.
To make the code from StackOverflow work you need macro enabled file saved and "link.png" file in the same directory. Note that the example code adds icons relatively to A1 (reference in calling PutLinksInACell() procedure) and puts three icons (For i = 1 To 3 in insertPicture procedure) regardless of the size of passed array.

To make things simple you could consider to have one link per cell, have text that is currently above hyperlink as text to display, format hyperling cell with standard colour and without underlining to hide hyperlink formatting.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close