worksheets

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,
Kevin has posted for me the following code in which "HYPERLINK" is a
subRoutine.the code cycles thru all the worksheets.I wanna know if there is
any way to get the procedure cycle only thru the first 3 worksheets.the first
three worksheets have different names?

Private Sub CommandButton18_Click()
Dim ws as Worksheet
For Each ws in ThisWorkBook.Worksheets
ws.Activate
HYPERLINK
Next ws
end sub
thanx.
 
Private Sub CommandButton18_Click()
dim wCtr as long
for wctr = 1 to 3
worksheets(wctr).Activate
myHYPERLINK
Next wctr
end sub

ps. I don't think I'd use Hyperlink as a name as a subroutine.
 
Just SHIFT + click to select the sheets then run

Private Sub CommandButton18_Click()
Dim ws as Worksheet
For Each ws in ActiveWindow.SelectedSheets
ws.Activate
HYPERLINK
Next ws
End sub


Gord Dibben MS Excel MVP
 
thanx Dave.

Dave Peterson said:
Private Sub CommandButton18_Click()
dim wCtr as long
for wctr = 1 to 3
worksheets(wctr).Activate
myHYPERLINK
Next wctr
end sub

ps. I don't think I'd use Hyperlink as a name as a subroutine.
 
Back
Top