View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
pimar[_8_] pimar[_8_] is offline
external usenet poster
 
Posts: 1
Default hyperlink to other sheets in the workbook using vba


Hello everybody
my question is about using hyperlinks from VBA
I'd like to define a "next" and "previous" link in each worksheet of my
workbook, so that the "next" link will move on next sheet in the
workbook, while "previous" will activate the previous sheet.
Since my workbook will consist of a lot of sheets that are copies of
the same "master" sheet, my idea is to set the link info via VBA, in
the

Private Sub Worksheet_Activate() method..

In all the example I've found about using the Hyperlink, the hyperlink
is to html or email...

I've used this, but it does not work:


Private Sub Worksheet_Activate()

wsindex = ActiveSheet.Index
wsprev = Worksheets(wsindex - 1).Name
wsnext = Worksheets(wsindex + 1).Name
MsgBox (wsprev & " " & wsnext)

With ActiveSheet
Hyperlinks.Add Anchor:=.Range("A1"), _
Address:=Worksheets(wsprev), _
ScreenTip:=wsprev, _
TextToDisplay:="PREVIOUS SHEET"
End With

With ActiveSheet
Hyperlinks.Add Anchor:=.Range("b1"), _
Address:=Worksheets(wsnext), _
ScreenTip:=wsnext, _
TextToDisplay:="NEXT SHEET"
End With


What is wrong?
thanks
*pimar


--
pimar
------------------------------------------------------------------------
pimar's Profile: http://www.excelforum.com/member.php...fo&userid=5386
View this thread: http://www.excelforum.com/showthread...hreadid=515090