새 시트를 만들고 주문하는 데 잘 작동하는 VBA 스크립트가 있습니다. 항목이 목록에서 제거되면 시트를 삭제하려고합니다. 어떻게이 일을 할 수 있습니까?목록에 Excel 시트가 없습니다.
Sub AddSheet()
Application.ScreenUpdating = False
Sheets("Master").Visible = True
Dim bottomA As Integer
bottomA = Range("A" & Rows.Count).End(xlUp).Row
Dim c As Range
Dim ws As Worksheet
For Each c In Sheets("01_Update_Employee_Lists").Range("E2:E" & bottomA)
Set ws = Nothing
On Error Resume Next
Set ws = Worksheets(c.Value)
On Error GoTo 0
If ws Is Nothing Then
Sheets("master").Select
Sheets("master").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = c.Value
End If
Next c
Sheets("Master").Visible = False
Application.ScreenUpdating = True
' sort worksheets in a workbook in ascending order
Dim sCount As Integer, i As Integer, j As Integer
Application.ScreenUpdating = False
sCount = Worksheets.Count
If sCount = 1 Then Exit Sub
For i = 1 To sCount - 1
For j = i + 1 To sCount
If (Worksheets(j).Name < Worksheets(i).Name) Then
Worksheets(j).Move Before:=Worksheets(i)
End If
Next j
Next i
End Sub
일반적으로 [게시물에 인사말이나 인사말을 사용해서는 안됩니다.] (http://meta.stackoverflow.com/questions/276033/pointless-question-edit/276037#276037). 그들은 우리의 길을 걸어 실제 질문을 이해합니다. 나는 당신을 위해 이번에 그들을 편집했습니다. –
'bottomA'가'01_Update_Employee_Lists'에서 어떻게 나오고 있다고 판단합니까? 나는'ActiveSheet'에 대해 응답하지 않을 것이고'bottomA'는 정수가 아닌 long이어야합니다. – Jeeped
"Sheets ("01_Update_Employee_Lists "). Range ("E2 : E "& bottomA)"를 참조하고 있습니다. – Alsjka