|
ThesWorkbookのコードモジュールに以下を記述
Option Explicit
Private Sub Workbook_Open()
With Worksheets("Sheet1")
.OLEObjects("ComboBox1").Object.List = GetSheetNames(.Name)
End With
End Sub
Private Function GetSheetNames(strExclusion As String) As Variant
Dim i As Long
Dim j As Long
Dim vntData() As Variant
With Sheets
For i = 1 To .Count
If .Item(i).Name <> strExclusion Then
ReDim Preserve vntData(j)
vntData(j) = .Item(i).Name
j = j + 1
End If
Next i
End With
GetSheetNames = Application.Transpose(vntData)
End Function
Sheet1のコードモジュールに以下を記述
Option Explicit
Private Sub ComboBox1_Change()
With ComboBox1
If .ListIndex <> -1 Then
Sheets(.Value).Activate
End If
End With
End Sub
|
|