View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Sorting a value based upon the values that appear in row A

Hi Steve,

Assume your data to be in Columns A, B and C and that you want to swotch the
order of the entite columns.

Try:

Sub Tester()
Columns("C:C").Cut
Columns("A:A").Insert Shift:=xlToRight
Columns("C:C").Cut
Columns("B:B").Insert Shift:=xlToRight
End Sub

---
Regards,
Norman



"Steve" wrote in message
...
I have three columns in my spreadheet.

They appear in the following order (these column names
appear in row A):
Score
FirstName
Surname

Is it possible to write a macro that will re-order these
columns so that they appear as follows:
Surname
FirstName
Score

Ideally, any solution will be based on the strings that
appear on the above and not on the column letters (as it
is possible that they may appear in a different order from
time to time).

Many thanks
Steve