0

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.

Jonathan
  • 3
  • 1
  • 3

1 Answers1

0

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>"
Laim
  • 78
  • 1
  • 8
  • Somewhat, however it needs double quotes in the HTML field which would break the function – Jonathan Feb 25 '20 at 18:20
  • 1
    **UPDATE** I tried it and it looks like it works. I was unaware that single quotes would work for that bit of HTML. Thank you!!! Do you know if there would be any instance where the single quotes might not work for someone? Seems like it's proper in any case: https://stackoverflow.com/questions/242766/is-it-correct-to-use-single-quotes-for-html-attributes – Jonathan Feb 25 '20 at 18:30
  • @aybabtu I've personally never had an issue with single quotes, however I can update the function to use double quotes instead if you'd prefer? – Laim Feb 25 '20 at 19:21
  • @Liam I did try with double quotes and it broke the function. I'm probably doing the syntax wrong though. The single quote seem to be working for me just fine, but I'd be interested to see the double quote version anyway :) – Jonathan Feb 26 '20 at 20:35