I am using the following VBA Code. Colum A in the sheet has a formula that pulls data from another sheet that is sorted via a VBA code on value in a different column . The problem is that this code does not sort at top due to zeros in blank cells. Is there something that needs to be added to correct this issue? </SPAN>
Private Sub Worksheet_Change(ByVal Target As Range)</SPAN>
If Intersect(Target, Range("a2:l6000")) Is Nothing Then Exit Sub</SPAN>
Application.EnableEvents = False</SPAN>
Me.sort.SortFields.Clear</SPAN>
Me.sort.SortFields.Add Key:=Range("a2:a6000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal</SPAN>
With Me.sort</SPAN>
.SetRange Range("A2:l6000")</SPAN>
.Header = xlGuess</SPAN>
.MatchCase = False</SPAN>
.Orientation = xlTopToBottom</SPAN>
.SortMethod = xlPinYin</SPAN>
.Apply</SPAN>
End With</SPAN>
Application.EnableEvents = True</SPAN>
End Sub</SPAN>
Private Sub Worksheet_Change(ByVal Target As Range)</SPAN>
If Intersect(Target, Range("a2:l6000")) Is Nothing Then Exit Sub</SPAN>
Application.EnableEvents = False</SPAN>
Me.sort.SortFields.Clear</SPAN>
Me.sort.SortFields.Add Key:=Range("a2:a6000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal</SPAN>
With Me.sort</SPAN>
.SetRange Range("A2:l6000")</SPAN>
.Header = xlGuess</SPAN>
.MatchCase = False</SPAN>
.Orientation = xlTopToBottom</SPAN>
.SortMethod = xlPinYin</SPAN>
.Apply</SPAN>
End With</SPAN>
Application.EnableEvents = True</SPAN>
End Sub</SPAN>