Home › Forum › Domande su Excel Generale › [RISOLTO] MACRO CHE MI DA ERRORE DI Routin troppo grande › Rispondi a: [RISOLTO] MACRO CHE MI DA ERRORE DI Routin troppo grande
Ciao
Si in effetti troppe istruzioni; non capisco perchè cancelli una cella alla volta; quantomento fai per mese
Sub elimina()
Dim rng As Range
Dim n As Integer
Dim ws As Worksheet
Set ws = Sheets("Foglio1") 'nome tuo foglio
Set rng = ws.Range("B2:AF4")
For n = 1 To 12
rng.ClearContents
Set rng = rng.Cells(1, 1).Offset(4, 0).Resize(3, 31)
Next n
Set rng = Nothing
Set ws = Nothing
End Sub
Oppure usare una singola istruzione dove concentrare tutti i 12 range mensili
Sub elimina2()
Dim rng As Range
Dim ws As Worksheet
Set ws = Sheets("Foglio1") 'nome tuo foglio
Set rng = ws.Range("B2:AF4,B6:AF8,B10:AF12,B14:AF16,B18:AF20,B22:AF24," & _
"B26:AF28,B30:AF32,B34:AF36,B38:AF40,B42:AF44,B46:AF48")
rng.ClearContents
Set rng = Nothing
Set ws = Nothing
End Sub
-
Questa risposta è stata modificata 7 mesi, 4 settimane fa da
sid.