A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

how to auto arrange in alphabetical order-excel sheet



 
 
Thread Tools Display Modes
  #1  
Old February 8th, 2007, 06:25 PM posted to microsoft.public.excel.newusers
subha
external usenet poster
 
Posts: 5
Default how to auto arrange in alphabetical order-excel sheet

how to auto arrange in alphabetical order-excel sheet after typing names in
random?
  #2  
Old February 8th, 2007, 07:05 PM posted to microsoft.public.excel.newusers
Gary''s Student
external usenet poster
 
Posts: 7,584
Default how to auto arrange in alphabetical order-excel sheet

Let's say we are entering data in column A and we want to alphbetize the
column as entries are made. Try the following macro:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Range("A:A"), Target) Is Nothing Then
Exit Sub
End If
Range("A:A").Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub

This goes in worksheet code:

1. right-click the tab name at the bottom of the window
2. select View Code - VBE window will open
3. paste the macro in the VBE window and then just close the VBE window
--
Gary's Student
gsnu200704


"subha" wrote:

how to auto arrange in alphabetical order-excel sheet after typing names in
random?

  #3  
Old February 8th, 2007, 08:47 PM posted to microsoft.public.excel.newusers
Gord Dibben
external usenet poster
 
Posts: 20,252
Default how to auto arrange in alphabetical order-excel sheet

As Dave Peterson has pointed out a few times, this may not be a good idea.

Reason.............perhaps a spelling mistake is made on last entry.

Before user can correct it after hitting ENTER, that entry has been sorted to
who knows where.

A manual DataSort might be better after a check for proper entry.


Gord Dibben MS Excel MVP

On Thu, 8 Feb 2007 11:05:01 -0800, Gary''s Student
wrote:

Let's say we are entering data in column A and we want to alphbetize the
column as entries are made. Try the following macro:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Range("A:A"), Target) Is Nothing Then
Exit Sub
End If
Range("A:A").Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub

This goes in worksheet code:

1. right-click the tab name at the bottom of the window
2. select View Code - VBE window will open
3. paste the macro in the VBE window and then just close the VBE window


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:02 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.