엑셀
엑셀 vba 시트_선택_없으면_만들기
아스C#
2018. 11. 28. 00:30
반응형
Sub 시트_선택_없으면_만들기(stname As String)
b = Application.DisplayAlerts
Application.DisplayAlerts = False
Dim s As Variant
bb = False
For Each s In Sheets
If s.Name = stname Then
s.Select
bb = True
Exit For
End If
Next s
If bb = False Then
Set s = Sheets(Main_Sheet)
With ActiveWorkbook
cnt = .Worksheets.count
s.Copy After:=.Sheets(cnt)
.Worksheets(cnt + 1).Name = stname
End With
End If
Application.DisplayAlerts = b
End Sub
.
반응형