Jak
Well-known Member
- Joined
- Apr 5, 2002
- Messages
- 833
Hello All
I am looking for advice and or examples on how to arrange columns by criteria. The criteria is the name in the header row assigned to each column and the arrangement is to be made via macro code.
On an Excel spreadsheet the titles below will be situated above a column anywhere on the spreadsheet. Unfortunately they will not be in the order below and there will be additional headings.
Column 1 = Forename
Column 2 = Initial
Column 3 = Surname
Column 4 = DOB
Column 5 = Ethnicity
Column 6 = Gender
Column 7 = Centre Candidate Id.
Therefore I need to delete all the columns that do not have one of the header titles listed above and then re-arrange the columns on the spreadsheet so that they match the criteria above.
i.e. lets say row 1 header row had titles arranged as such:
Ethnicity, Sales Tax, Initial, Forecast, Product Id, Forename, DOB, Centre Candidate Id., Surname, Gender
I would need to delete columns headed with:
Sales Tax, Forecast, Poduct Id
Thereafter I would be left with:
Ethnicity, Initial, Forename, DOB, Centre Candidate Id., Surname, Gender
I would then need to arrange these columns so that they read:
Forename, Initial, Surname, DOB, Ethnicity, Gender, Centre Candidate Id.
I need to do this via a macro and would appreciate any thoughts on how best to do this.
If this is not clear, please post your questions. Cheers.
I am looking for advice and or examples on how to arrange columns by criteria. The criteria is the name in the header row assigned to each column and the arrangement is to be made via macro code.
On an Excel spreadsheet the titles below will be situated above a column anywhere on the spreadsheet. Unfortunately they will not be in the order below and there will be additional headings.
Column 1 = Forename
Column 2 = Initial
Column 3 = Surname
Column 4 = DOB
Column 5 = Ethnicity
Column 6 = Gender
Column 7 = Centre Candidate Id.
Therefore I need to delete all the columns that do not have one of the header titles listed above and then re-arrange the columns on the spreadsheet so that they match the criteria above.
i.e. lets say row 1 header row had titles arranged as such:
Ethnicity, Sales Tax, Initial, Forecast, Product Id, Forename, DOB, Centre Candidate Id., Surname, Gender
I would need to delete columns headed with:
Sales Tax, Forecast, Poduct Id
Thereafter I would be left with:
Ethnicity, Initial, Forename, DOB, Centre Candidate Id., Surname, Gender
I would then need to arrange these columns so that they read:
Forename, Initial, Surname, DOB, Ethnicity, Gender, Centre Candidate Id.
I need to do this via a macro and would appreciate any thoughts on how best to do this.
If this is not clear, please post your questions. Cheers.