sorting data from one tab on another

G

Guest

I have a spread sheet with a list of users sorted alphabetically. I'd like
to sort that data by userID on a different tab. Problem is, I don't want to
manually do it. Is there a way to have the 'ID sorted tab' automatically
update and sort itself as I make changes to the 'alphabetical tab'?

Thanks for your help!
 
G

Guest

Put this in Worksheet code for Sheet1:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Range("A:A"), Target) Is Nothing Then
Exit Sub
End If
Application.EnableEvents = False
Sheets("sorted").Range("A:A").Clear
Sheets("Sheet1").Range("A:A").Copy Sheets("sorted").Range("A1")
Sheets("sorted").Range("A:A").Sort key1:=Sheets("sorted").Range("A1")
Application.EnableEvents = True
End Sub


Whenever data is changed in column A in Sheet1, the data is automatically
copied over to sheet "sorted" and sorted.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top