I have autosorted two of my rows using VBA in excel.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Not Intersect(Target, Range("C:D")) Is Nothing Then
Range("C3").Sort Key1:=Range("C4"), _
Order1:=xlAscending, _
Key2:=Range("D4"), _
Order2:=xlAscending, _
Header:=xlYes, _
OrderCustom:=2, MatchCase:=False, _
Orientation:=xlTopToBottom
End If
End Sub
I have auto sorted column C and D in ascending order.
But when i merge 2 cells in Column J (i.e. J53 and J54) the auto sorting does not work for the Column C and D or the entire sheet we can say.
I want to merge the cells in Column J as well as make Column C and D auto sort using VBA.
NB: similarly i want to sort to 2 cells in Column K as well.