Using Excel 2010 & 2007
Windows 10
I would really appreciate some more help regarding a macro, please.
I've had help to get this macro but, (as in a similiar issue with a macro to sort column in date order - since solved) when I run the macro to sort Column 'C', containing names, into alphabetical order, the associated rows don't always keep the same sorted order.
In other words, the data that has been entered along the row, in relation to a name, isn't always kept to that associated row, so the entered figures are not always pertaining to the details entered in Columns 'C', 'D', 'E', 'F' etc.
This is my current code
The previous issue, re sorting the date, was solved in post here - https://www.mrexcel.com/forum/excel-questions/1079390-macro-sort-dates.html
It may help to explain what I'm probably not explaining well The code below was allowing the rows to be randomly mixed
The code here (below), provided by 'yky' solved the problem.
"Try this: "
I must admit it took me some time and a lot of comparing etc to see the difference between the code I was using and the code yky suggested but, once I'd seen where it differed and I edited the code, it worked perfectly.
I've had a good look at both versions of code and tried to work out where I might edit the code for the Sort Alphabetically macro but it's really got me stumped.
I'm hoping something similiar will solve the Sorting Alphabetically macro too, and hoping one of you will be able to help me out
Many thanks for any help and advice
%
Windows 10
I would really appreciate some more help regarding a macro, please.
I've had help to get this macro but, (as in a similiar issue with a macro to sort column in date order - since solved) when I run the macro to sort Column 'C', containing names, into alphabetical order, the associated rows don't always keep the same sorted order.
In other words, the data that has been entered along the row, in relation to a name, isn't always kept to that associated row, so the entered figures are not always pertaining to the details entered in Columns 'C', 'D', 'E', 'F' etc.
This is my current code
Code:
Sub SortName()
'
' Sort Name Column 'C' - A-Z
ActiveSheet.Unprotect
' Range("B24").Select
' ActiveWindow.SmallScroll Down:=50
Range("B24:AB100").Select
ActiveSheet.Sort.SortFields.Clear
ActiveSheet.Sort.SortFields.Add Key:=Range("C24:C100"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveSheet.Sort
.SetRange Range("B24:AB100")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Range("C26").Select
End Sub
The previous issue, re sorting the date, was solved in post here - https://www.mrexcel.com/forum/excel-questions/1079390-macro-sort-dates.html
It may help to explain what I'm probably not explaining well The code below was allowing the rows to be randomly mixed
Code:
Sub Date_Order_1()
'
' Date_Order Macro
' Puts Date (Column B) in ascending order
'
' Keyboard Shortcut:
ActiveSheet.Unprotect Password:=""
With ActiveSheet
.Unprotect
.[A16:BZ115].Sort Key1:=[B16], Order1:=xlAscending
.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End With
ActiveSheet.Protect Password:=""
End Sub
The code here (below), provided by 'yky' solved the problem.
"Try this: "
Code:
Sub Date_Order_1()
....
.Range("A16:BZ115").Sort Key1:=Range("B16"), Order1:=xlAscending
I've had a good look at both versions of code and tried to work out where I might edit the code for the Sort Alphabetically macro but it's really got me stumped.
I'm hoping something similiar will solve the Sorting Alphabetically macro too, and hoping one of you will be able to help me out
Many thanks for any help and advice
%