I have 2 worksheets with the same headers in different orders. Headers are I.D, Name, Department, Sales, Start date, End Date and a few others.
What I am aiming to do is search through the workbooks in which the headers may be in different orders, find the column which has unique values (in this case I.D), then move this column to column A in the worksheet and sort the rest of the headers/ data in both worksheets so the layout is the same. I am aiming to do this in VBA.
Currently I sort the worksheets manually and copy the relevant column to the first column in the worksheet and check the cells match.
For Each mycell In ActiveWorkbook.Worksheets(shtSheet2).UsedRange If Not mycell.Value = ActiveWorkbook.Worksheets(shtSheet1).Cells(mycell.Row, mycell.Column).Value Then mycell.Interior.Color = vbYellow difference = difference + 1 End If If mycell.Value = ActiveWorkbook.Worksheets(shtSheet1).Cells(mycell.Row, mycell.Column).Value Then matches = matches + 1 End If Next