i to all
this macro delete values between sheets
Sub prova_cancella()
Dim i As Long
Dim sh As String, DaCancellare As String
Application.ScreenUpdating = False
For i = 1 To Sheets.Count
If Sheets(i).Name = "pen" Then
sh = Sheets(i).Name
DaCancellare = "D2:B13"
ElseIf Sheets(i).Name = "pos" Then
sh = Sheets(i).Name
DaCancellare = "E3:F14"
ElseIf Left(Sheets(i).Name, 5) = "spese" And Right(Sheets(i).Name, 4) <> "anno" Then
sh = Sheets(i).Name
DaCancellare = "A7:AO66"
End If
Application.EnableEvents = False
Sheets(sh).Select
Sheets(sh).Unprotect
Sheets(sh).Range(DaCancellare).ClearContents
Sheets(sh).Protect
Application.EnableEvents = True
Next i
Application.ScreenUpdating = True
End Sub
the sheets are "pen" / "pens" / "spese" / "anno"
now I have added a new sheet "new_anno" but nothing must be deleted from this new sheet
how to modify the macro because you don't delete the values of the new sheet?
I hope I have explained
Thank you
john
Bookmarks