ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add Hyperlink (https://www.excelbanter.com/excel-programming/366148-add-hyperlink.html)

Edmund

Add Hyperlink
 
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.

Ive tried recording macro for hyperlink but cant seem to understand how to
modify it. My modifications kept returning error, hence, needing your sample.

Thanks a lot

--
Edmund
(Using Excel XP)

Leith Ross[_628_]

Add Hyperlink
 

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

-------------------


Sincerely,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=55798



All times are GMT +1. The time now is 12:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com