codice:
With ExWs
Do Until (n = h + 1)
.Cells(h + 1, 1).Value = .Cells(n, 1).Value
.Cells(h + 1, 2).Value = .Cells(n, 2).Value
.Cells(h + 1, 3).Value = .Cells(n, 3).Value
.Cells(h + 1, 4).Value = .Cells(n, 4).Value
Do Until (z = h + 1)
If .Cells(z, 1).Value < .Cells(h + 1, 1) Then
.Cells(h + 2, 1).Value = .Cells(h + 1, 1).Value ' alla prima query risponde bene...
.Cells(h + 2, 2).Value = .Cells(h + 1, 2).Value ' ...ma alla seconda come al solito
.Cells(h + 2, 3).Value = .Cells(h + 1, 3).Value
.Cells(h + 2, 4).Value = .Cells(h + 1, 4).Value
.Cells(h + 1, 1).Value = Cells(z, 1).Value ' e qui mi dà l'errore metodo cells global
.Cells(h + 1, 2).Value = Cells(z, 2).Value
.Cells(h + 1, 3).Value = Cells(z, 3).Value
.Cells(h + 1, 4).Value = Cells(z, 4).Value
.Cells(n, 1).Value = .Cells(h + 1, 1).Value
.Cells(n, 2).Value = .Cells(h + 1, 2).Value
.Cells(n, 3).Value = .Cells(h + 1, 3).Value
.Cells(n, 4).Value = .Cells(h + 1, 4).Value
.Cells(z, 1).Value = .Cells(h + 2, 1).Value
.Cells(z, 2).Value = .Cells(h + 2, 2).Value
.Cells(z, 3).Value = .Cells(h + 2, 3).Value
.Cells(z, 4).Value = .Cells(h + 2, 4).Value
End If
z = z + 1
Loop
z = n + 1
n = n + 1
Loop
.Cells(h + 1, 1).Value = ""
.Cells(h + 1, 2).Value = ""
.Cells(h + 1, 3).Value = ""
.Cells(h + 1, 4).Value = ""
.Cells(h + 2, 1).Value = ""
.Cells(h + 2, 2).Value = ""
.Cells(h + 2, 3).Value = ""
.Cells(h + 2, 4).Value = ""
End With ' fine riordino