|
Option Explicit
'シートの存在チェック
Private Function ExSheetexist(sheetname As String) As Boolean
Dim tsheet As Object
ExSheetexist = False
'全シートを順に調べる
For Each tsheet In ActiveWorkbook.Worksheets
If LCase(tsheet.Name) = LCase(sheetname) Then
'同じ名前が見つかれば終了
ExSheetexist = True
Exit For
End If
Next
End Function
Private Sub CommandButton1_Click()
'検索シート名を指定し検索
If ExSheetexist(Range("C7")) Then
CommandButton1.Caption = "見つかりました。"
Else
CommandButton1.Caption = "見つかりませんでした。"
End If
End Sub
|
|