VBA Challenge! How do i save the fidelity of a VBA Hyperlink?

Born2dive00

New Member
Joined
Nov 15, 2019
Messages
4
Hello everyone I would like to thank you all in advance for your kind help, I have a good working knowledge of excel, BUT I am rather new to VBA and I could really use some of your help.

So I was able to create a simple formula that looked at cells Sheet2 A8 and B8 to create a hyperlink in C8, using this formula. =IF(OR(A8,(B8)=" "),(""),HYPERLINK(B8,A8))
This does exactly what I want it to do by creating a hyperlink, simple enough.

Now using this VBA Code I was able to put the result C8 (my newly created hyperlink) into Sheet1 A1, all good so far, I got the text without a code in A1 (it is imperative that A1 is free from typed formulas, as it will go into a table, and the formula will cause a mismatch).

HOWEVER it put the value in A1 as a text, and lost the newly generated hyperlink.

How can I preserve the fidelity of the generated Hyperlink (NOT the code, only the hyperlink!) with the VBA code???


Thank you all for your help
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I can not seem to be able to upload the book, so here is the VBA Code I used to put the Sheet2 C8 hyperlink into the Sheet1 A1 Cell.

Code:
Sub Diver()
Dim s1 As Worksheet, s2 As Worksheet
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s1.Range("A1") = s2.Range("C8")
End Sub

Please let me know

Thank you all
 
Upvote 0
Hi, welcome to the forum!

What does your hyperlink link to? Is it a cell in the spreadsheet, or a web page, or something else?

Maybe you can give us an example of what is in cells A8 and B8 of sheet2?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,854
Messages
6,121,941
Members
449,056
Latest member
denissimo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top