Add Hyperlink

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like VBA to insert hyperlink into cell A50 & below for every part
number contained in B1:Z1
..
When the hyperlinks are available in column A, users no longer need to
scroll through B1:Z1 in search of part numbers.

I’ve tried recording macro for hyperlink but can’t seem to understand how to
modify it. My modifications kept returning error, hence, needing your sample.

Thanks a lot
 
Hello Edmund,

Here is the macro to "bookmark" your parts on the worksheet. Change th
Worksheet name (its commented in the code) to whatever the name of you
worksheet is. The example assumes Sheet1.


Code
-------------------

Sub BookmarkParts()

Dim LinkCell As Range
Dim PartCell As Range
Dim Wks As Worksheet

'Put your worksheet name inside the quotes
Set Wks = Worksheets("Sheet1")

For Each PartCell In Wks.Range("B1:Z1")
I = I + 1
With Wks
Set LinkCell = .Cells(I, "A")
.Hyperlinks.Add Anchor:=LinkCell, Address:="", SubAddress:=PartCell.Address, TextToDisplay:=PartCell.Value
End With
Next PartCell

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top