Hi,
So i needed a macro that could help me re arrange a bunch of coulmns to a certain order instead of having to do it manually cut and paste all the time. I found a good youtube that did what i was looking for exactly video but in the end it didnt work... i would message the youtuber but im sure asking here would get me much faster results than having to wait on youtube. Please help
So i needed a macro that could help me re arrange a bunch of coulmns to a certain order instead of having to do it manually cut and paste all the time. I found a good youtube that did what i was looking for exactly video but in the end it didnt work... i would message the youtuber but im sure asking here would get me much faster results than having to wait on youtube. Please help
Code:
Sub vds()
Dim new_column_order As Variant, new_index As Integer
Dim found As Range, counter As Range
new_column_order = Array("Item ID", "Vendor Type", "Kit Flag", "Source", "Vendor", "Vendor Liasion", "Manufacturer", "RTV Category", "Date RTV Category", "User RTV Category", "Shelf", "Prior Category", "Product Group", "Booknet", "warehouse", "has_lithium", "openbox", "dfi", "Date Received", "Customer Purchase Date", "RMA Date", "Defect Cat", "Defect Desc", "Serial No", "Item Code", "Cust Flag", "catlgno", "buyer", "brand", "Description", "Long Catalog No", "PO", "Is Used", "Multi Vendor Flag", "Last Vendor", "Return Reason 1")
counter = 1
For new_index = LBound(new_column_order) To UBound(new_column_order)
Set found = Rows("1:1").Find(new_column_order(new_index), LookIn:=xlValues, _
lookat:=xlWhole, searchorder:=xlByColumns, searchdirections:=xlNext, MatchCase:=False)
If Not found Is Nothing Then
If found.Column <> counter Then
found.EntireColumn.Cut
Columns(counter).Insert shift:=xlToRight
End If
counter = counter + 1
End If
Next new_index
End Sub