Sub Inseriscidati()
'''
Dim Data As Date, MioMese(), MiaData As String
Dim sh As Worksheet
MioMese = Array("GENNAIO", "FEBBRAIO", "MARZO", "APRILE", "MAGGIO", "GIUGNO", _
"LUGLIO", "AGOSTO", "SETTEMBRE", "OTTOBRE", "NOVEMBRE", "DICEMBRE")
MiaData = MioMese(Month([B1]) - 1)
On Error Resume Next
Set sh = Worksheets(MiaData).Activate
For a = 7 To 150
If Cells(a, 1).Value = Foglio1.Range("B1").Value + 1 Then
Cells(a, 1).Select
Cells(a, 1).Activate
ActiveCell.EntireRow.Insert Shift:=xlDown
Cells(a - 1, 5).Select
Selection.Copy
Cells(a, 5).Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Cells(a, 1).Value = Foglio1.Range("B1").Value ' data pagamento
Cells(a, 2).Value = Foglio1.Range("B3").Value ' numero fattura
Cells(a, 3).Value = Foglio1.Range("B5").Value ' data fattura
Cells(a, 4).Value = Foglio1.Range("B7").Value ' codice cliente
Cells(a, 5).Value = Foglio1.Range("A11").Value + " " + Foglio1.Range("B9").Value + " " + Foglio1.Range("B11").Value
Cells(a, 9).Value = Foglio1.Range("B13").Value
Exit For
End If
Next
End Sub
|