Ho uno script VB che inserisce una riga in un foglio excell.
Lo script funziona, ma non riesco a capire a fine script di posizionarsi all'inizio della riga creata e non alla fine.
Graziecodice:Sub ADDRIGA() Dim Add As String, Riga As String, Pos As Integer Add = Selection.Address Pos = InStr(2, Add, "$") Riga = Right$(Add, Len(Add) - Pos) If Riga < 7 Or Riga > 1498 Then MsgBox ("Riga non Inseribile!") Exit Sub End If ActiveSheet.Unprotect Rows(Riga).Select Selection.Insert Shift:=xlDown Cells(Riga - 1, 4).Select Selection.AutoFill Destination:=Range(Cells(Riga - 1, 4), Cells(Riga + 1, 4)), _ Type:=xlFillDefault Cells(Riga - 1, 6).Select Selection.AutoFill Destination:=Range(Cells(Riga - 1, 6), Cells(Riga + 1, 6)), _ Type:=xlFillDefault Cells(Riga - 1, 8).Select Selection.AutoFill Destination:=Range(Cells(Riga - 1, 8), Cells(Riga + 1, 8)), _ Type:=xlFillDefault Cells(Riga - 1, 10).Select Selection.AutoFill Destination:=Range(Cells(Riga - 1, 10), Cells(Riga + 1, 10)), _ Type:=xlFillDefault Cells(Riga - 1, 11).Select Selection.AutoFill Destination:=Range(Cells(Riga - 1, 11), Cells(Riga + 1, 11)), _ Type:=xlFillDefault Cells(Riga, 1) = Cells(Riga - 1, 1) ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True End Sub

Rispondi quotando
