LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 159
Default Help with sorting issue??

I have the following code to sort column b in worksheet1 based on name which
works just fine however when it sorts it does not keep all the cells
together, how do I make it keep the cell together then sort column b?

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "B2:B5001"

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Me.Cells(.Row, "A").Value =
WorksheetFunction.Max(Range("A1:A5001")) + 1
Me.Range("A:G").Sort key1:=Me.Range("B3"), header:=xlYes
End With
End If

ws_exit:
Application.EnableEvents = True

End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting issue Linda Broyles Excel Worksheet Functions 2 December 7th 07 10:36 PM
sorting issue brian Excel Discussion (Misc queries) 2 May 11th 07 03:27 PM
Sorting issue ewagz Excel Programming 1 October 14th 06 03:44 AM
Sorting Issue. Please help V-ger Excel Discussion (Misc queries) 17 November 15th 05 12:27 AM
sorting issue - help gennario Excel Discussion (Misc queries) 0 February 28th 05 05:27 PM


All times are GMT +1. The time now is 08:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"