Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

How to Copy Hyperlinks over to a new sheet VBA


I followed the code and examples taught in the youtube video titled "Search for and View Data using a Form in Excel - Idiot-Proof Excel - Part 6" and it works great for extracting my data from the table into a more readable format. However one of my columns includes hyperlinks to drawings and I cannot get the hyperlink to copy over to the new sheet. How can I change the code below so that the hyperlink from my original table can be accessed in the new more readable format?

 sourceSheet.Range("F16").Value = dataSheet.Cells(recordRow, 21).Value


Hi. I posted an comment several days ago suggesting you upload a file so I can see your hyperlinks. I can't do more until you do.
John_Ru (rep: 5147) May 8, '23 at 10:04 am
Add to Discussion



Hi ExcelentGrayT and welcome to the Forum.

If dataSheet.Cells(recordRow, 21).is the location of the some text and an associated hyperlink, you should be able to copy both to F16 using this line in place of the one in your question:

sourceSheet.Hyperlinks.Add Anchor:=Range("F16"), Address:=dataSheet.Cells(recordRow, 21).Hyperlinks(1).Address, TextToDisplay:=dataSheet.Cells(recordRow, 21).Value

Hope this fixes your problem. If so, please be sure to mark this Answer as Selected.



Whe nI have inserted that line into my code I get back the error "Invalid procedure call or argument". Thank you for trying.
excelentgrayt May 3, '23 at 11:33 am
Gray(?). That line works in my file (but without the assignments sourceSheet and dataSheet). It's often hard to help without an Excel file so please edit your original question and use the Add Files... button to upload a representative Excel file (without any personal data) to show your existing data (and any macros). Then we should be able to give specific help (but tomorrow probably).
John_Ru (rep: 5147) May 3, '23 at 1:50 pm
Hi Did you see my suggestion above?
John_Ru (rep: 5147) May 5, '23 at 5:31 am
Add to Discussion

Answer the Question

You must create an account to use the forum. Create an Account or Login