Sort by columns
Closed
clara
-
May 20, 2010 at 10:07 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - May 20, 2010 at 02:33 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - May 20, 2010 at 02:33 PM
Related:
- Sort by columns
- Chrome sort bookmarks alphabetically - Guide
- Tweetdeck larger columns - Guide
- Display two columns in data validation list but return only one - Guide
- Spotify sort by genre - Guide
- How to delete columns in word - Guide
5 responses
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
May 20, 2010 at 10:12 AM
May 20, 2010 at 10:12 AM
Not much has been provided
you can start the macro recorder.
do the sort
stop the recorder
viola, you have your macro
you can start the macro recorder.
do the sort
stop the recorder
viola, you have your macro
Hi and sorry I did not tell enough info, actually I want to do it by code not recording a macro if that is possible, you think you can help me, if yes let me explain you in more details:
I have 9 columns like this: The first three columns are client, status and time, and this repeat two more times just beside the last column of time, so it woul look something like this:
Week 1
A B C D E F G H I
3 client status time client status time client status time
4 XX arrive 7:80 ....
Week 2
A B C D E F G H I
19 client status time client status time client status time
20 XX arrive 7:80
Week 3
A B C D E F G H I
30 client status time client status time client status time
31XX arrive 7:80
Week 4
A B C D E F G H I
42 client status time client status time client status time
54 XX arrive 7:80
so I have four weeks with different clients and different arrival times and I want to sort only by the columns C, F and I (the time columns) for every week. Also the four weeks are in the same tab named "sheet2". There's any chance that this columns can be sort at the same time the user writes down the arrival times??
Thanks
I have 9 columns like this: The first three columns are client, status and time, and this repeat two more times just beside the last column of time, so it woul look something like this:
Week 1
A B C D E F G H I
3 client status time client status time client status time
4 XX arrive 7:80 ....
Week 2
A B C D E F G H I
19 client status time client status time client status time
20 XX arrive 7:80
Week 3
A B C D E F G H I
30 client status time client status time client status time
31XX arrive 7:80
Week 4
A B C D E F G H I
42 client status time client status time client status time
54 XX arrive 7:80
so I have four weeks with different clients and different arrival times and I want to sort only by the columns C, F and I (the time columns) for every week. Also the four weeks are in the same tab named "sheet2". There's any chance that this columns can be sort at the same time the user writes down the arrival times??
Thanks
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
May 20, 2010 at 11:46 AM
May 20, 2010 at 11:46 AM
Could you please upload a sample file with sample data etc on some shared site like https://authentification.site , http://wikisend.com/ , http://www.editgrid.com etc and post back here the link to allow better understanding of how it is now and how you foresee.
Hi this is the link of the file
https://authentification.site/files/22538129/Arrival_dates.xls
Thanks
https://authentification.site/files/22538129/Arrival_dates.xls
Thanks
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
May 20, 2010 at 12:42 PM
May 20, 2010 at 12:42 PM
so based on you sample, lets say for week one. Do you want the whole block for week one to be sorted based on column C. F and I. Or is it to be sorted for each block of Client - Status - time individually within a week
Hi,
umm, every week has its 5 days, I need every day to be sorted by the column time in other words for each block client-status-time, each block represents a day for me.
Thank you
umm, every week has its 5 days, I need every day to be sorted by the column time in other words for each block client-status-time, each block represents a day for me.
Thank you
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
May 20, 2010 at 02:33 PM
May 20, 2010 at 02:33 PM
The most easy way would be that you name range representing each block of day for every week. I named them as "W1B1", "W1B2", "W1B3", "W1B4", "W1B5", "W2B1", "W2B2", "W2B3", "W2B4", "W2B5", "W3B1", "W3B2", "W3B3", "W3B4", "W3B5", "W4B1", "W4B2", "W4B3", "W4B4", "W4B5"
based on your sample this is one of the named ranges
W1B1 : ='CE Outbound'!$A$3:$D$23
If you want to do it automatically, you have to use event of the sheet. So when you start the VBE, double click on the sheet in which you have the names. Then call this routine as
based on your sample this is one of the named ranges
W1B1 : ='CE Outbound'!$A$3:$D$23
Sub SortData() Dim SortRanges As Variant Dim SortRange As Variant Dim sAddress As String SortRanges = Array("W1B1", "W1B2", "W1B3", "W1B4", "W1B5", _ "W2B1", "W2B2", "W2B3", "W2B4", "W2B5", _ "W3B1", "W3B2", "W3B3", "W3B4", "W3B5", _ "W4B1", "W4B2", "W4B3", "W4B4", "W4B5") For Each SortRange In SortRanges sAddress = Range(SortRange).Address If (InStr(1, sAddress, ":") > 0) Then sAddress = Left(sAddress, InStr(1, sAddress, ":") - 1) End If Range(SortRange).Sort _ Key1:=Range(sAddress).Offset(1, 1), Order1:=xlAscending, _ Header:=xlYes, OrderCustom:=1, _ MatchCase:=False, Orientation:=xlTopToBottom Next End Sub
If you want to do it automatically, you have to use event of the sheet. So when you start the VBE, double click on the sheet in which you have the names. Then call this routine as
Private Sub Worksheet_Change(ByVal Target As Range) Call SortData End Sub