Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a vba form which adds a name to the bottom of the list. How so I make
that list of names automatically sort alphabetically. -- CG |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Right click on the sheet of interest; paste this code into the window that
opens: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 1 And Target.Row = 1 Then Range("A1", Range("A1").End(xlDown)).Select Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom End If End Sub May need a bit of modifying, btu this should be pretty darn close... Regards, Ryan--- -- RyGuy "CG" wrote: I have a vba form which adds a name to the bottom of the list. How so I make that list of names automatically sort alphabetically. -- CG |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You should disable events within the Change event before making any
changes. Otherwise, the Change event makes a change, that triggers Change, which makes a change that triggers Change, as so on until you run out of stack space. Private Sub Worksheet_Change(ByVal Target As Range) Application.EnableEvents = False ''' ' code ''' Application.EnableEvents =True End Sub Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Thu, 20 Nov 2008 22:13:00 -0800, ryguy7272 wrote: Right click on the sheet of interest; paste this code into the window that opens: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 1 And Target.Row = 1 Then Range("A1", Range("A1").End(xlDown)).Select Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom End If End Sub May need a bit of modifying, btu this should be pretty darn close... Regards, Ryan--- |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am having an Compiled Error: Expected:expression error in the := of
the last 2 lines. What does this mean? Sorry I am new to VBA! -- CG "ryguy7272" wrote: Right click on the sheet of interest; paste this code into the window that opens: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 1 And Target.Row = 1 Then Range("A1", Range("A1").End(xlDown)).Select Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom End If End Sub May need a bit of modifying, btu this should be pretty darn close... Regards, Ryan--- -- RyGuy "CG" wrote: I have a vba form which adds a name to the bottom of the list. How so I make that list of names automatically sort alphabetically. -- CG |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Alphabetical sort with formulas | Excel Discussion (Misc queries) | |||
Alphabetical sort in a macro | Excel Programming | |||
alphabetical sort | Excel Worksheet Functions | |||
Sort - Not Alphabetical | Excel Discussion (Misc queries) | |||
sort last names by in alphabetical order | Excel Discussion (Misc queries) |