
Sub Inserisci()
Const ValoreFisso = "88888888AAA88"
Dim Riga As Long
Riga = 1
Do While Cells(Riga + 1, 3) <> ""
If Cells(Riga + 1, 3) <> Cells(Riga, 3) + 1 Then
Range(Cells(Riga + 1, 3), Cells(Riga + 1, 4)).Insert xlDown
Cells(Riga + 1, 3) = Cells(Riga, 3) + 1
Cells(Riga + 1, 4) = ValoreFisso
End If
Riga = Riga + 1
Loop
End Sub |
Sub a()
r = 3
Columns("C:D").NumberFormat = "@"
While Cells(r, "C") <> ""
If Cells(r, "C") - Cells(r - 1, "C") = 2 Then
Rows(r).Insert
Cells(r, "C") = Format(Cells(r - 1, "C") + 1, "0000000")
Cells(r, "D") = "88888888AAA88"
End If
r = r + 1
Wend
End Sub |
If Cells(r, "C").Value - Cells(r - 1, "C").Value = 2 Then |
