| 
    
     |  | ComboBox1で2004などの年を選択し、CommandButton1で1年分のシートを名前を月に変えて作成、CommandButton2で1年分を一括削除します。以下のコードでシートの作成まではできたのですが、一括削除がうまく動きません。教えてください。 
 Private Sub CommandButton1_Click()
 Dim mysht As String
 Dim i As Integer
 
 For i = 1 To 12
 mysht = Format(ComboBox1.Value & "/" & i & "/1", "yyyy年mm月")
 
 On Error Resume Next
 Worksheets(mysht).Select
 
 If Err Then
 Worksheets("Template").Copy After:=Worksheets(Worksheets.Count)
 Worksheets(Worksheets.Count).Name = mysht
 Worksheets(mysht).Range("A2").Value = mysht
 
 Err.Clear
 End If
 Next
 On Error GoTo 0
 End Sub
 
 
 |  |