![]()
Sub Test() Dim ched, phed, lr As Long Sheets("Sheet1").Select 'First Name Copy Paste Process '--------------------------------------------------------------------------------------------- ched = Application.WorksheetFunction.Match("First Name", Sheets("Sheet1").Range("1:1"), False) phed = Application.WorksheetFunction.Match("First Name", Sheets("Sheet2").Range("1:1"), False) lr = Sheets("Sheet1").Cells(Rows.Count, ched).End(xlUp).Row Range(Cells(2, ched), Cells(lr, ched)).Copy Sheets("Sheet2").Cells(2, phed) '--------------------------------------------------------------------------------------------- Sheets("Sheet2").Select Range(Cells(2, phed), Cells(Rows.Count, phed).End(xlUp)).NumberFormat = "DD/MM/YY" 'Last name Copy Paste Process '--------------------------------------------------------------------------------------------- ched = Application.WorksheetFunction.Match("Last name", Sheets("Sheet1").Range("1:1"), False) phed = Application.WorksheetFunction.Match("Last name", Sheets("Sheet2").Range("1:1"), False) lr = Sheets("Sheet1").Cells(Rows.Count, ched).End(xlUp).Row Range(Cells(2, ched), Cells(lr, ched)).Copy Sheets("Sheet2").Cells(2, phed) '--------------------------------------------------------------------------------------------- 'country name Copy Paste Process '--------------------------------------------------------------------------------------------- ched = Application.WorksheetFunction.Match("country name", Sheets("Sheet1").Range("1:1"), False) phed = Application.WorksheetFunction.Match("country name", Sheets("Sheet2").Range("1:1"), False) lr = Sheets("Sheet1").Cells(Rows.Count, ched).End(xlUp).Row Range(Cells(2, ched), Cells(lr, ched)).Copy Sheets("Sheet2").Cells(2, phed) '---------------------------- End Sub
Bookmarks