How do I convert a dynamic coded hyperlink in excel to the equivalent HTML code?-ThrowExceptions

Exception or error:

I’ve found a similar question, but the answer didn’t solve my issue. I’m trying to do a similar thing as this post, but I’m not sure if my original Excel cells are populated with the same thing.

Mine don’t have a fixed link, but rather reference other cells using the following formula:

=HYPERLINK("https://www.website.com/search/?search="&B2, "View")

I’ve tried running the VBA code from the linked post above, but no luck. Is there a tweak for this to populate the resolved URL into the proper HTML code using “View” for the hyperlink text? The value in cell B2 is a number, let’s say 12345.

So I’d like the end result to populate the cell with:

<a href="https://www.website.com/search/?search=12345>View</a>

End goal: I’m trying to export the Excel data as HTML table code, so trying to prepare the cells for proper HTML format to display the links on the website. Any export method I’ve found just exports the hyperlink cell as plain text “View” which is obviously not the desired result. If I can convert these cells before the export, then that solution would work fine.

Alternately, if there’s a way to directly export the entire spreadsheet to an HTML encoded table (while also converting the hyperlinks as above), that would be even better. Note: the export to website function within Excel (using 2016) does not work…I need simple, plain HTML list code that doesn’t reference the original spreadsheet.

How to solve:

Sorry if I’ve misunderstood your question, but does this help?

enter image description here

Function for Column B

="<a href='https://www.website.com/search/?search="&A2&"'>View</a>"

Leave a Reply

Your email address will not be published. Required fields are marked *