I am trying to change the order of columns in a spreadsheet ,I've stumbled across a piece of code that looks like it will do what i want but i get an error (application-defined or object-defined error) everytime i run it, any help would be appreciated.
Sub Movecolumns() Dim ori As Variant Dim dst As Variant Dim i As Integer ori = Array("A", "B", "C") dst = Array("C", "B", "A") For i = LBound(ori) To UBound(ori) Columns(ori(i)).Cut Columns(dst(i)).Insert Shift:=xlToRight Next Range("A6").Select End Sub
Bookmarks