i have a question about sor function in excel:
i need to sort the column A:3 to A:100 from smallest to largest, but in this column A, i want that column A:20 would not be sorted and just leave it as it is.is it possible to do this?![]()
i have a question about sor function in excel:
i need to sort the column A:3 to A:100 from smallest to largest, but in this column A, i want that column A:20 would not be sorted and just leave it as it is.is it possible to do this?![]()
You'd need a macro to do it, but this should work...
![]()
Sub SortWithException() Const sSORT_RANGE = "A1:A100" Const sEXCEPTION = "A20" Dim lExceptionValue As Long Dim rngMatchException As Range lExceptionValue = Range(sEXCEPTION).Value Range(sSORT_RANGE).Sort Range(sSORT_RANGE), xlAscending Set rngMatchException = Range(sSORT_RANGE).Find(lExceptionValue, lookat:=xlWhole) If rngMatchException Is Nothing Then 'Oh dear Else rngMatchException.Delete shift:=xlShiftUp Range(sEXCEPTION).Insert shift:=xlShiftDown Range(sEXCEPTION).Value = lExceptionValue End If End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks