Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Multiple hyperlinks via macro?

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Multiple hyperlinks via macro?

Ron,

Sub testit()
Dim i As Long, lngLastRow As Long

With Sheet1
lngLastRow = .Cells(1, 1).End(xlDown).Row
For i = 1 To lngLastRow
.Hyperlinks.Add .Cells(i, 1), "2004/Backups/040110.xls", , ,
..Cells(i, 1)
Next
End With
End Sub

Rob

"Ron" wrote in message
...
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Multiple hyperlinks via macro?

Dave,

For the address and text used

Address:="2004/Backups/040110.xls", _
TextToDisplay:=.Cells(iRow, "A").Value

Worked exactly as required.

Thank you and best wishes

Ron

On Sat, 10 Jan 2004 13:41:09 -0600, Dave Peterson
wrote:

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple hyperlinks KK New Users to Excel 1 July 15th 07 01:00 PM
Multiple hyperlinks MartinW Excel Worksheet Functions 4 March 26th 06 03:50 AM
Multiple Hyperlinks Per Cell Robert Links and Linking in Excel 1 October 5th 05 11:44 PM
multiple hyperlinks Michele Excel Worksheet Functions 0 March 8th 05 02:43 PM
Multiple hyperlinks Mustard Excel Discussion (Misc queries) 1 November 27th 04 03:22 PM


All times are GMT +1. The time now is 03:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"