Sub insert_riga() Dim Riga As Variant Riga = InputBox("inserire numero riga") Rows(Riga & ":" & Riga).Select Selection.Copy Selection.Insert Shift:=xlDown Application.CutCopyMode = False End Sub
Sub InsertRows() Dim Righe As Integer, r As Long Righe = Application.InputBox("Numero righe da inserire", Type:=1) If Righe = 0 Then Exit Sub r = Cells(Rows.Count, 3).End(xlUp).Offset(1, 0).Row Rows(r - 1).Copy Rows(r & ":" & r + Righe).Select Selection.Insert Shift:=xlDown Application.CutCopyMode = False Range("C" & r).Select End Sub
dodo47, 17/09/2023 10:47:ciao devi occuparti anche della riga dei totali, altrimenti questi resteranno fermi alla riga 22 quando inserisci le righe. Pertanto: 1) inserisci una riga vuota prima dei totali 2) modifichi le formule con somme fino a riga 23 (quella vuota) 3) volendo tale riga la puoi assottigliare e colorarla in grigio scuro (o come ti pare). Infine utilizzi questo codice: Sub InsertRows() Dim Righe As Integer, r As Long Righe = Application.InputBox("Numero righe da inserire", Type:=1) If Righe = 0 Then Exit Sub r = Cells(Rows.Count, 3).End(xlUp).Offset(1, 0).Row Rows(r - 1).Copy Rows(r & ":" & r + Righe).Select Selection.Insert Shift:=xlDown Application.CutCopyMode = False Range("C" & r).Select End Sub Saluti