Sort sheet alphabetically

Jakson

New Member
Joined
Sep 14, 2021
Messages
21
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I've got a data entry sheet on this workbook my agency uses for business purposes.

The data entry sheet consists of names, addresses, personal identifier numbers, and a type label.

Users are currently navigating to this sheet manually, reviewing the content of the sheet for completeness, manually entering new data, then manually sorting the sheet alphabetically on column A's last name values.

The data is duplicated four times so that there are 5 total copies of the same information, per person entered.

I'm familiar with inputboxes but I'm not sure how to go about sorting this sheet alphabetically through VBA.

Guidance is deeply appreciated
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
You could use this snippet I once wrote for sorting data with VBA.
Just edit it to suit your needs.


VBA Code:
Public Sub SortAZ()
Dim ws As Worksheet: Set ws = ThisWorkbook.Worksheets("data")
    With ws.Sort
        .SortFields.Clear
        .SortFields.Add Key:=ws.Range("A1"), Order:=xlAscending
        .SetRange ws.Range("A1:B999")
        .Header = xlYes
        .Apply
    End With
End Sub
 
Upvote 0
Solution
You could use this snippet I once wrote for sorting data with VBA.
Just edit it to suit your needs.


VBA Code:
Public Sub SortAZ()
Dim ws As Worksheet: Set ws = ThisWorkbook.Worksheets("data")
    With ws.Sort
        .SortFields.Clear
        .SortFields.Add Key:=ws.Range("A1"), Order:=xlAscending
        .SetRange ws.Range("A1:B999")
        .Header = xlYes
        .Apply
    End With
End Sub
Ooooo!!!

Awesome!!! Thank you so so much! I'll tweak it and mess with it as soon as I can! I just got buried in some work that came out from under our feet. WOOPs!

I bet this is it though! Thank you, @PeteWright !
 
Upvote 0
You could use this snippet I once wrote for sorting data with VBA.
Just edit it to suit your needs.


VBA Code:
Public Sub SortAZ()
Dim ws As Worksheet: Set ws = ThisWorkbook.Worksheets("data")
    With ws.Sort
        .SortFields.Clear
        .SortFields.Add Key:=ws.Range("A1"), Order:=xlAscending
        .SetRange ws.Range("A1:B999")
        .Header = xlYes
        .Apply
    End With
End Sub
Just wanted to come back and let you know @PeteWright , it works like a charm!

I've got some work to do to make the rest of my thingie do what I want but this little code snippet saved me a TON of time!
 
Upvote 0
Just wanted to come back and let you know @PeteWright , it works like a charm!

I've got some work to do to make the rest of my thingie do what I want but this little code snippet saved me a TON of time!
Glad to hear that!
Let me know if you need anything else.

Kind regards
Pete
 
Upvote 0

Forum statistics

Threads
1,214,992
Messages
6,122,631
Members
449,095
Latest member
bsb1122

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