View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Multiple hyperlinks via macro?

Option Explicit
Sub testme01()

Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long

With ActiveSheet
FirstRow = 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row

For iRow = FirstRow To LastRow Step 2
.Hyperlinks.Add Anchor:=.Cells(iRow, "A"), _
Address:="2004/Backups/040110.xls", _
TextToDisplay:="Lusc....... "
Next iRow
End With
End Sub

But I'm not sure what goes in the address and texttodisplay parms.

You can use:
.cells(irow,"A").value
to retrieve the text in the cell if you want.

Ron wrote:

Help please for adding hyperlinks with a macro.

The result of a macro recording session using only one cell AI is
below

Range("A1").Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
"2004/Backups/040110.xls", TextToDisplay:= _
"Lusc....... "

How can I hyperlink multiple cells beginning in A1 and then in every
odd row number in Col A?

eg.
A

1. Lusc...
2. Occu..
3. Boun...
4. Savo...
5. Pana...
6. Sail...

The total number of rows varies each time the macro runs.

TIA

Ron


--

Dave Peterson