Excel macro 2016 in VBA. Need to copy from 8 separated columns from one sheet to another, in different order. Tried but the Paste is done always in same column A...
You are not telling the code where to paste with: Sheets("TMP").Paste
. You only name the sheet but not the column.
Also use a loop so you do not need to keep retyping the same thing:
Sub Button1_Click()
Dim ultima_fila As Long
Dim columnOrd As Variant
columnOrd = Array("A", "B", "C", "G", "F", "R", "S", "T")
With Sheets("Validation by rules")
ultima_fila = .Cells(.Rows.Count, 1).End(xlUp).Row
Dim i As Long
For i = 1 To 8
MsgBox .Range(.Cells(1, columnord(i - 1)), .Cells(ultima_fila, columnord(i - 1))).Address
.Range(.Cells(1, columnord(i - 1)), .Cells(ultima_fila, columnord(i - 1))).Copy Destination:=Sheets("TMP").Cells(1, i)
Next i
End With
End Sub