What is a hyperlink?

Insert hyperlink into pic using vba

  • i have a new list of model pics Col A has the model number and Col B the pic. i already used code to pick up the Model from Col A to name the pic. now the new list does not contain some of the old models which have been discontinued. i want to pick up the hyperlink address from the old pics. here is what i have: Dim myLink As String For Each c In Range("A9:A243") 'The new list mymodel = c.Value Set y = Sheets("Pic List").Range("A:A").Find(mymodel, LookAt:=xlWhole) 'The old list If y Is Nothing Then c.Interior.Color = 255 ' New model so no hyperlink in old list so do manually Else 'Using the Watch window I get a value for myLink myLink = Sheets("Pic List").Shapes(mymodel).Hyperlink.Address 'Gets hyperlink from old list 'The next line gives me an 'Application or Object defined error' ActiveSheet.Shapes(mymodel).Hyperlink.Address = myLink End If Next c End Sub thanks for the help

  • Answer:

    The code ActiveSheet.Shapes(mymodel).Hyperlink.Address = myLink is wrong. To give the shape mymodel on Sheet1 a hyperlink to the address myLink, use code like this Dim myLink As String Dim shp As Shape [...] Set wks = ThisWorkbook.Sheets("Sheet1") Set shp = wks.Shapes(mymodel) shp.Hyperlink.Delete wks.Hyperlinks.Add shp, myLink

Miningco.com Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.