PDA

View Full Version : Hyperlinks(index) -



DragonHunter
06-07-2011, 05:06 PM
Hello everybody

i have a code to open automatically a list of webpages from an excel sheet but it isn't working.

the urls looks like:
test.com/webpage1
test.com/webpage2
....
test.com/webpage30

in A1:A30 excel cells,

code to open webpages is:
Sub openlinks()
For i = 1 To 30
Range("A" & i).Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=False
Next i
End Sub

code to create hyperlinks:

Sub insertarhipervinculo()
For i = 1 To 30
Range("A" & i).Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
"test.com/webpage" & i, TextToDisplay:="test.com/webpage" & i
Next i
End Sub


When i execute the sub openlinks() i got the same webpage #1
in the 30 windows

But the hyperlinks seem ok, in fact i make click in the hyperlink cell A19 and i get the webpage19.

Thanks in advance

DH

orange
06-08-2011, 06:18 AM
You get the 30 replications of the same hyperlink because you use (1) instead of (i).