Hi,
I am trying to sort names in column B. My problem is that all empty strings get sorted on top and I want them to be sorted on bottom.
The sheet begins with empty cells and the the names comes after.
Problem Details:
in B14 I have the following formula:
=TRIM(C14&" "&D14&" "&E14&" "&F14)
Formila is copied until cell B64
The sorting range is:
Range("B14:FT64")
Code:
Private Sub CommandButton5_Click()
'Sorting Names aphabatically
With ActiveSheet
.Unprotect Password:="1122"
.Range("B14:FT64").Select
Selection.Sort Key1:=Range("B14"), Order1:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom
ActiveSheet.Protect "1122", DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowSorting:=True
.Range("C14").Select
End With
End Sub
Any ideas?
Bookmarks