PDA

View Full Version : Making URLS Hyperlinks



bopo
07-21-2007, 07:51 AM
Hi

I have a spreadsheet with 200 URLS in and I would like to make them all hyperlinks, what is the fastest method to do this?

Cheers

Bob Phillips
07-21-2007, 08:21 AM
Sub AddHyperlinks()
Const TEST_COLUMN As String = "A" '<=== change to suit
Dim i As Long
Dim iLastRow As Long
With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = 1 To iLastRow 'iLastRow to 1 Step -1
.Hyperlinks.Add Anchor:=.Cells(i, TEST_COLUMN), _
Address:=.Cells(i, TEST_COLUMN).Value, _
TextToDisplay:=.Cells(i, TEST_COLUMN).Value
Next i
End With
End Sub

bopo
07-21-2007, 08:31 AM
Hi

I inserted it within the ThisWorkBook sheet but when I open it, nothing happens, any ideas.

Bob Phillips
07-21-2007, 08:33 AM
Doesn't go within ThisWorkbook, but in a standard code module. Then just run it.

bopo
07-21-2007, 08:35 AM
Yep working now, thanks :)