vba for alphanumerically sorting column

imisy3d

New Member
Joined
Sep 3, 2013
Messages
19
1 How Have You Been? Receptive communicationDialogue (2)Unit 1, Lesson 5 Michelle Lapides, Kenneth Ness, Andrew Weidigx
168 Role-Shifting Three Characters: Me explain do-do to 3 different peopleASL Up Close (role shifting 3 characters)ExampleWhere? (Unit, Lesson) Andrew WeidigNot needed
169 Role-Shifting Three Characters: Marathon winnersASL Up Close (role shifting 3 characters)ExampleWhere? (Unit, Lesson) Andrew WeidigNot needed
170 Planning a PartyAction Communication 15MonologueUnit 3, Lesson 3 Monique Holt
171 Four Days LeftAction Communication 18MonologueUnit 3, Lesson 5 Luisray Aguilar
172 A Day in My Life in 2040 1Receptive communicationMonologueUnit 10, Lesson 1 Colin Analco
173 A Day in My Life in 2040 2Receptive communicationMonologueUnit 10, Lesson 1 Pali Dacanay
174 Survey Perspective: Map - Home look like what. ******* on left, bedroom down hall. ASL Up Close: Survey Perspective (map)ExampleWhere? (Unit, Lesson) Aimee SeverNot needed
484 Survey Perspective: Map - Restaurant there. Parking lot nearby. ASL Up Close: Survey Perspective (map)ExampleWhere? (Unit, Lesson) Aimee SeverNot needed
485 You're a Winner!ASL Up Close (surprise)Dialogue (2)Where? (Unit, Lesson) Michelle Lapides, Katasha Walker
486***Introduction to The CandleThe Lion & Other StoriesMonologueWhere? (Unit, Lesson) Robert RiveraNot needed
491***Introduction to The HotelThe Lion & Other StoriesMonologueWhere? (Unit, Lesson) Robert RiveraNot needed
493 Surprise: [surprised face, mouth open. Up close]ASL Up Close (surprise)ExampleWhere? (Unit, Lesson) Norma MoranNot needed
494 Surprise: Recent watch TV, click-remote-control++. See news. Orange-eyes why? Spot my friend win fs-lotto!ASL Up Close (surprise)ExampleWhere? (Unit, Lesson) Norma MoranNot needed
1640 Trip to MexicoABC StoryLiteratureUnit 1, Lesson 1 Dennise ScottxBlurry. Looks odd.
1641 Abbe de l’EpeeReceptive communicationMonologueUnit 1, Focus Michelle Lapides
1642 Home Layout Description 1ASL Up Close (layout)DescriptionUnit 2, Lesson 2 Michelle Lapides
1643 Jack and the BeanstalkStoryLiteratureUnit 10, Lesson 1 Robin Shannon
1644 My Dream VacationReceptive communicationMonologueUnit 1, Lesson 1 Thomas Welchx
1645 Italian StoryStoryMonologueUnit 8, Lesson 2 Joette Paulone
1646 Flower Pot at Pennsylvania School for the DeafNot usingMonologueN/A, N/A Joette PauloneNot needed
907gv5179The Rise of Oralism 486-***Taking Care of YourselfUnit 4, Focus Deaf Awareness Ad (v5179)
907hv5180Discovering Deaf Identity491-***Taking Care of YourselfUnit 4, CTDIdentity (v5180)
907iv5181Audism907g-v5179In My Free TimeUnit 5, ToolboxThe Deaf Man (v5181)
907jv5182Double Minority: Black Deaf907h-v5180I Think….Unit 6, FocusPay Attention (v5182)
907kv5183Deaf Places907i-v5181I Think….Unit 6, ToolboxRocky Mountain Deaf School (v5183)
908av5184Crime & Punishment907j-v5182News & Current EventsUnit 8, Lesson 2First Responder (v5184)
908aav5185Talking About Government & Politics 907k-v5183News & Current EventsUnit 8, Lesson 5Elections Canada (v5185)
908bv5186Collectivism908a-v5184News & Current EventsUnit 8, CTDAm I the only Deaf Teenager? (v5186)
908bbv5187Unusual Jobs908aa-v5185The Work WorldUnit 9, Lesson 3Deaf Mugger (v5187)
908cv5188Rhyme908b-v5186Exploration 1 (Rhyme & Rhythm) Exploration 1, Lesson 1Three Little Pigs (v5188)
908ccv5189Rhyme & Rhythm Together 908bb-v5187Exploration 1 (Rhyme & Rhythm) Exploration 1, Lesson 3Grouchy Monkey (v5189)
908dv5190Rhyme & Rhythm Together 908c-v5188Exploration 1 (Rhyme & Rhythm) Exploration 1, Lesson 3ASL Song - Thanksgiving (v5190)
908ddv5191The Rise of Oralism 908cc-v5189Taking Care of YourselfUnit 4, Focus Oralists' Lies (v5191)
908ev5192Discovering Deaf Identity908d-v5190Taking Care of YourselfUnit 4, CTDPointless: Big D, Small D (v5192)
908eev5193Bio: George Veditz908dd-v5191Taking Care of YourselfUnit 4, ToolboxWho is George Veditz? (v5193)
908fv5194You Have to Be Deaf to Understand 908e-v5192I Think….Unit 6, CTDYellow Diamond-Shaped (v5194)
908ffv5195Talking About Government & Politics 908ee-v5193News & Current EventsUnit 8, Lesson 5Why are we not politically active (v5195)
908gv5196Workplace Problems & Solutions 908f-v5194The Work WorldUnit 9, Lesson 4nTouch Advertisement (v5196)
908hv5197The Future of the Deaf Community908ff-v5195Changing TimesUnit 10, CTDThe End (v5197)

<colgroup><col span="2"><col><col><col><col><col><col><col span="2"><col><col></colgroup><tbody>
</tbody>

<tbody>
</tbody>

please check it, i want to sort column A Alphanumerically and all other columns adjust automatically according to sorting of A column

any body can help

its urgent
thx
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
its urgent
It may be to you but when looking for free help as on this forum it isn't a good idea to sound demanding. :)
Refer also to point 12 of the Posting Guidelines



.. i want to sort column A Alphanumerically ..
1. From your post, it isn't possible to tell for sure where column A ends.

2. You may also assist helpers by explaining, and/or giving examples, what you mean by sorting "alphanumerically".
 
Upvote 0
It may be to you but when looking for free help as on this forum it isn't a good idea to sound demanding. :)
Refer also to point 12 of the Posting Guidelines



1. From your post, it isn't possible to tell for sure where column A ends.

2. You may also assist helpers by explaining, and/or giving examples, what you mean by sorting "alphanumerically".

ok
1
1640
1646
168
169
486
491
493
494
907g
907h
908ee
908ff
908g
908h

<colgroup><col width="72" style="width:54pt"> </colgroup><tbody>
</tbody>
these should be like
1
168
169
486
491
493
494
907g
907h
908ee
908ff
908g
908h
1640
1646



<colgroup><col width="72" style="width:54pt"> </colgroup><tbody>
</tbody>
total rows are A1 to A7000 while in columns A1 to L1
if i sort column A, then other columns text should be adjusted as per sort of column a
thx
 
Upvote 0
Thanks, that's clearer. :)

I've assumed there are headings in row 1 and the data starts in row 2. Advise if that is not the case.

Test in a copy of your workbook.
Rich (BB code):
Sub SortNumberAlpha()
  Dim a
  Dim nc As Long, i As Long, ubA As Long
  Dim v As Double
  Dim s As String
  
  nc = Cells.Find(What:="*", After:=Cells(1, 1), LookIn:=xlValues, _
    SearchOrder:=xlByColumns, SearchDirection:=xlPrevious, SearchFormat:=False).Column + 1
  a = Range("A2", Range("A" & Rows.Count).End(xlUp)).Value
  ubA = UBound(a, 1)
  For i = 1 To ubA
    s = a(i, 1)
    v = Val(s)
    a(i, 1) = Format(v, String(10, "0")) & Mid(s & "z", 1 + Len(CStr(v)))
  Next i
  Application.ScreenUpdating = False
  With Range("A2").Resize(ubA, nc)
    .Columns(nc).Value = a
    .Sort Key1:=.Cells(1, nc), Order1:=xlAscending, Header:=xlNo, OrderCustom:=1, _
      MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
    .Columns(nc).ClearContents
  End With
  Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thanks, that's clearer. :)

I've assumed there are headings in row 1 and the data starts in row 2. Advise if that is not the case.

Test in a copy of your workbook.
Rich (BB code):
Sub SortNumberAlpha()
  Dim a
  Dim nc As Long, i As Long, ubA As Long
  Dim v As Double
  Dim s As String
  
  nc = Cells.Find(What:="*", After:=Cells(1, 1), LookIn:=xlValues, _
    SearchOrder:=xlByColumns, SearchDirection:=xlPrevious, SearchFormat:=False).Column + 1
  a = Range("A2", Range("A" & Rows.Count).End(xlUp)).Value
  ubA = UBound(a, 1)
  For i = 1 To ubA
    s = a(i, 1)
    v = Val(s)
    a(i, 1) = Format(v, String(10, "0")) & Mid(s & "z", 1 + Len(CStr(v)))
  Next i
  Application.ScreenUpdating = False
  With Range("A2").Resize(ubA, nc)
    .Columns(nc).Value = a
    .Sort Key1:=.Cells(1, nc), Order1:=xlAscending, Header:=xlNo, OrderCustom:=1, _
      MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
    .Columns(nc).ClearContents
  End With
  Application.ScreenUpdating = True
End Sub


bundle of thx ... its working perfectly
again thx
 
Upvote 0
one problem is there
023a
023b
23

see this, 23 should come first then 23a, and 23b

can you please solve it

<colgroup><col width="72" style="width:54pt"> </colgroup><tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,217,367
Messages
6,136,140
Members
449,994
Latest member
Rocky Mountain High

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top