VBA to reorder columns in a List View

Nick3995

New Member
Joined
Jun 20, 2012
Messages
1
I have a listobject bound to a sharepoint list. I am trying to use vba to move the columns around. It is possible to click on a header and drag a column from one location in the list to another. When I record this action in a macro and then attempt to run the code again. It fails. There are no errors generated but it fails to actually move the column. It inserts a new column in the correct place but fails to copy the source into the new column and fails to remove the source from its original column. Here is the vba code that is generated:

Sub Macro5()
' Macro5 Macro
Range("ProjectList[[#Headers],[Account]]").Select
Selection.Cut
Range("ProjectList[[#All],[Title]]").Select
Selection.Insert Shift:=xlToRight
End Sub

I’m just wondering if anyone has done this before. If so offer some suggestions. I’ve researched the web for awhile and I’m coming up empty.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Forum statistics

Threads
1,214,419
Messages
6,119,389
Members
448,891
Latest member
tpierce

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top