Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
multiple hyperlinks | New Users to Excel | |||
Multiple hyperlinks | Excel Worksheet Functions | |||
Multiple Hyperlinks Per Cell | Links and Linking in Excel | |||
multiple hyperlinks | Excel Worksheet Functions | |||
Multiple hyperlinks | Excel Discussion (Misc queries) |