|
こんにちは。
SheetActivateイベントを使わないで、こんな感じにしてみたらどうですか?
Sub aas()
Dim msg As String, WB As Workbook, WBC As Integer, WBTB() As String
msg = "該当するブックの番号を記入してください。"
Bcnt = Workbooks.Count
ReDim WBTB(1 To Bcnt - 1)
For Each WB In Workbooks
If WB.Name <> ThisWorkbook.Name Then
WBC = WBC + 1
msg = msg & vbCrLf & WBC & " " & WB.Name
No = No + 1
WBTB(No) = WB.Name
End If
Next
On Error Resume Next
No = Application.InputBox(Prompt:=msg, _
Title:="セルの選択", Type:=1)
If 1 <= No And No <= Bcnt Then
MsgBox WBTB(No)
End If
End Sub
|
|