Application.ScreenUpdating = False
For ix = f.Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
Application.ScreenUpdating = False
Application.DisplayAlerts = False
If Trim(f.Cells(ix, 2)) = "" Then
Rows(ix).Delete
End If
If Trim(f.Cells(ix, 2)) <> "" Then
f.Cells(ix, 2) = CDate(f.Cells(ix, 2))
f.Cells(ix, 2).NumberFormat = "mm/dd/yyyy"
f.Cells(ix, 2) = Format(f.Cells(ix, 2), "mm/dd/yyyy")
End If
Next
Application.ScreenUpdating = False
For ixx = fx.Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
Application.ScreenUpdating = False
Application.DisplayAlerts = False
If Trim(fx.Cells(ixx, 3)) <> "" Then
fx.Cells(ixx, 2) = CDate(fx.Cells(ixx, 2))
fx.Cells(ixx, 3).NumberFormat = "mm/dd/yyyy"
fx.Cells(ixx, 3) = Format(Cells(ixx, 3), "mm/dd/yyyy")
End If
Next
Application.ScreenUpdating = True
'tableau des données de la feuille "progressivo_FATTURA"
With fx: Tablo1 = .Range(.Cells(3, 1), .Cells(.Columns(1).Cells(.Rows.Count).End(xlUp).Row, 5)).Value: End With
'tableau des données de la feuille "primanota"
With f: Tablo2 = .Range(.Cells(2, 1), .Cells(.Columns(1).Cells(.Rows.Count).End(xlUp).Row, 6)).Value: End With
nbl = UBound(Tablo2, 1)
'tableau provisoire pour Redim (col,lignes)
ReDim TabloTemp(1 To 6, 1 To nbl)
For i = 1 To nbl: For j = 1 To 6
TabloTemp(j, i) = Tablo2(i, j)
Next j: Next i
For i = 1 To UBound(Tablo1, 1)
With WorksheetFunction: idx = .Match(Tablo1(i, 1), .Index(TabloTemp, 6, 0), 1): End With
If TabloTemp(6, idx) <> Tablo1(i, 1) Then
nbl = nbl + 1
ReDim Preserve TabloTemp(1 To 6, 1 To nbl)
For k = nbl To idx + 2 Step -1: For j = 1 To 6
TabloTemp(j, k) = TabloTemp(j, k - 1)
Next j: Next k
TabloTemp(2, idx + 1) = Tablo1(i, 3)
TabloTemp(3, idx + 1) = "FT_" & Tablo1(i, 1)
TabloTemp(4, idx + 1) = Tablo1(i, 2)
TabloTemp(6, idx + 1) = Tablo1(i, 1)
' TabloTemp(11, idx + 1) = Tablo1(i, 1)
'TabloTemp(10, idx + 1) = CLng(Tablo1(i, 4))
'TabloTemp(16, idx + 1) = CLng(Tablo1(i, 4))
End If
Next i
For i = 1 To nbl
TabloTemp(1, i) = i
Next
f.Cells(2, 1).Resize(nbl, 11).Value = WorksheetFunction.Transpose(TabloTemp)
Application.ScreenUpdating = False
For a = f.Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
Application.ScreenUpdating = False
Application.DisplayAlerts = False
If Trim(f.Cells(a, 2)) <> "" Then
f.Cells(a, 2).Value = Format(f.Cells(a, 2).Value, "dd/mm/yyyy")
f.Cells(a, 2).Value = DateSerial(Year(f.Cells(a, 2).Value), Month(f.Cells(a, 2).Value), Day(f.Cells(a, 2).Value))
End If
Next
Application.ScreenUpdating = True