엑셀 매크로 시트 있는지 확인

Jmnote (토론 | 기여)님의 2012년 4월 2일 (월) 00:29 판

  • worksheet_exists
  • exist_worksheet
  • 엑셀 매크로 워크시트 있는지 확인
  • VBA 시트 이름 있는지 확인

1 함수

Function worksheet_exists(name)
    worksheet_exists = False
    For Each ws In ActiveWorkbook.Worksheets
        If ws.name = name Then worksheet_exists = True
    Next ws
End Function

2 테스트

Sub button1_Click()
    If worksheet_exists("시트이름") Then
        MsgBox "있음"
    Else
        MsgBox "없음"
    End If
End Sub
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}