Excel
excel 매크로 vba언어 시트생성시 이름지정후 시트생성
SeoHW
2021. 11. 10. 15:43
SMALL
Sub CrtSheet()
'Updated by ExtendOffice 20181009
Dim xName As String
Dim xSht As Object
On Error Resume Next
xName = InputBox("Please enter a name for this new sheet ", "Kutools for Excel")
If xName = "" Then Exit Sub
Set xSht = Sheets(xName)
If Not xSht Is Nothing Then
MsgBox "Sheet cannot be created as there is already a worksheet with the same name in this workbook"
Exit Sub
End If
Sheets.Add(, Sheets(Sheets.count)).Name = xName
End Sub
알림창 없이 추가시에는 아래처럼
Sub CrtSheet2()
Sheets.Add(, Sheets(Sheets.count)).Name = "시트이름"
End Sub
LIST