View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GysdeJongh GysdeJongh is offline
external usenet poster
 
Posts: 23
Default Selecting a specific tab in a tabstrip


"Dan" wrote in message
...
Hello -
I have a tabstrip, and I have tabs added, the number depending on other
things. I need to make a specific tab (the last one, the one with the
highest
index) the one that is selected. Right now, it shows the first tab (index
=
0) and I can't figure out how to write code to default to the last one.



Sub SelectLastWorksheet()
'
Dim wkbMyWorkbook As Workbook
Dim shtMyWorksheet As Worksheet
Dim K As Integer
'
Set wkbMyWorkbook = ActiveWorkbook
K = wkbMyWorkbook.Worksheets.Count
Set shtMyWorksheet = wkbMyWorkbook.Worksheets(K)
shtMyWorksheet.Activate
End Sub

hth
Gys