Hello,
Is it possible to sort names on 3 worksheets with a macro? Thereby keeping the row data intact.
Thank you
Hello,
Is it possible to sort names on 3 worksheets with a macro? Thereby keeping the row data intact.
Thank you
Wow this must be beyond this forums abilities. Thanks!
.
A basic and simple way of doing it would be to use the Excel Macro Recorder. Having run the recorder, it generated the following code that can be pasted into a routine module
and activated with a Command Button:
Admittedly, there are others ways of accomplishing your goal, but this is one that is always available to you.Option Explicit Sub Macro2() ' ' Macro2 Macro ' ' ActiveWorkbook.Worksheets("Personal Information").ListObjects("Table5").Sort. _ SortFields.Clear ActiveWorkbook.Worksheets("Personal Information").ListObjects("Table5").Sort. _ SortFields.Add Key:=Range("Table5[[#All],[Last Name ]]"), SortOn:= _ xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal With ActiveWorkbook.Worksheets("Personal Information").ListObjects("Table5"). _ Sort .Header = xlYes .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With Sheets("Job Assessments - Titles").Select Rows("3:15").Select ActiveWorkbook.Worksheets("Job Assessments - Titles").Sort.SortFields.Clear ActiveWorkbook.Worksheets("Job Assessments - Titles").Sort.SortFields.Add Key _ :=Range("A3"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _ xlSortNormal With ActiveWorkbook.Worksheets("Job Assessments - Titles").Sort .SetRange Range("A3:N15") .Header = xlNo .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With Sheets("2017 Training Records").Select Rows("3:15").Select ActiveWorkbook.Worksheets("2017 Training Records").Sort.SortFields.Clear ActiveWorkbook.Worksheets("2017 Training Records").Sort.SortFields.Add Key:= _ Range("A3"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _ xlSortNormal With ActiveWorkbook.Worksheets("2017 Training Records").Sort .SetRange Range("A3:Z15") .Header = xlNo .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With End Sub
Thank you for the very kind reply. I didn't think anyone would help me.
Since waiting I came up with another way. I used index match to bring the names and associated info to each of the worksheets from the personal information worksheet. That way when I sort it doesn't affect the row data on the other sheets.
Have a great day and thanks again!
Thanks for the Add Rep
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks