
Sub Copia_Col()
Dim Massimo As Integer
Massimo = 0
While Sheets("Foglio1").Cells(1, Massimo + 1).Value <> ""
Massimo = Massimo + 1
Wend
Sheets("Foglio1").Select
Range("C1").Activate
Columns(Massimo).Select
Selection.Copy
Sheets("Foglio2").Select
Columns(2 * Massimo / 3).Select
ActiveSheet.Paste
Sheets("Foglio1").Select
Columns(Massimo - 2).Select
Selection.Copy
Sheets("Foglio2").Select
Columns(2 * Massimo / 3 - 1).Select
ActiveSheet.Paste
End Sub |
funziona come se fosse una normale macro? |
Dim formula As String For i = 2 To 179 formula = "=SUMIF(R2C" & Selection.Column & ":R179C" & Selection.Column & ",R[0]C[-2],R2C" & Selection.Column + 1 & ":R180C" & Selection.Column + 1 & ")" formula = formula & "-" & "SUMIF(R2C" & Selection.Column - 4 & ":R179C" & Selection.Column - 4 & ",R[0]C[-2],R2C" & Selection.Column - 3 & ":R180C" & Selection.Column - 3 & ")" Cells(i, Selection.Column + 2).FormulaR1C1 = formula Next |
Range(Cells(2, 3 * Massimo + 1), Cells(179, 3 * Massimo + 2)).Select Selection.Sort Key1:=Cells(2, 3 * Massimo + 2), Order1:=xlDescending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal |
