Se parli del foglio Archivio allora queste istruzioni usano le celle R1:T2 per alcuni calcoli e poi cancellano tutto.
- Codice: Seleziona tutto
Cells(1, 18) = Cells(Rows.Count, 5).End(xlUp).Row
r1 = Cells(1, 18)
Cells(1, 19) = Cells(Rows.Count, 7).End(xlUp).Row
Cells(1, 20) = Cells(Rows.Count, 11).End(xlUp).Row
Cells(2, 18).Select
ActiveCell.FormulaR1C1 = "=LARGE(R[-1]C:R[-1]C[2],1)"
r = Cells(2, 18)
Range(Cells(1, 18), Cells(2, 20)).ClearContents
Dovresti coordinare l' uso delle celle con formule con l' uso delle celle nel vba; se non sai cosa fa il vba potresti provare a spostare "un po' piu' a destra" le tue formule, oppure su un altro foglio non lavorato dal vba.
Oppure, per una prova alla cieca, sostituisci tutto il blocco di sopra in
- Codice: Seleziona tutto
r1=Cells(Rows.Count, 5).End(xlUp).Row
If Cells(Rows.Count, 5).End(xlUp).Row > r then r=Cells(Rows.Count, 5).End(xlUp).Row
If Cells(Rows.Count, 7).End(xlUp).Row > r then r=Cells(Rows.Count, 7).End(xlUp).Row
If Cells(Rows.Count, 11).End(xlUp).Row > r then r=Cells(Rows.Count, 11).End(xlUp).Row
Ciao