Μετάβαση στο κύριο περιεχόμενο

Πώς να ταξινομήσετε δεδομένα σε πολλά φύλλα εργασίας ταυτόχρονα;

Στο Excel, μπορούμε να ταξινομήσουμε δεδομένα σε ένα φύλλο εργασίας με βάση μια συγκεκριμένη στήλη γρήγορα και εύκολα, αλλά έχετε προσπαθήσει ποτέ να ταξινομήσετε τα δεδομένα σε πολλά φύλλα εργασίας; Για να τα ταξινομήσετε ένα προς ένα θα είναι χρονοβόρα, αυτό το άρθρο, θα παρουσιάσω έναν εύκολο τρόπο για την επίλυσή του.

Ταξινόμηση δεδομένων σε πολλά φύλλα εργασίας ταυτόχρονα με τον κώδικα VBA


βέλος μπλε δεξιά φούσκα Ταξινόμηση δεδομένων σε πολλά φύλλα εργασίας ταυτόχρονα με τον κώδικα VBA

Για να ταξινομήσετε δεδομένα με βάση μια στήλη σε όλα τα φύλλα του βιβλίου εργασίας σας, ο ακόλουθος κώδικας VBA μπορεί να σας βοηθήσει.

1. Κρατήστε πατημένο το ALT + F11 για να ανοίξετε το Microsoft Visual Basic για εφαρμογές παράθυρο.

2. Κλίκ Κύριο θέμα > Μονάδα μέτρησηςκαι επικολλήστε τον ακόλουθο κώδικα στο Μονάδα μέτρησης Παράθυρο.

Κωδικός VBA: Ταξινόμηση δεδομένων σε πολλά φύλλα εργασίας ταυτόχρονα:

Sub SortAllSheets()
   'Updateby Extendoffice
   Dim WS      As Worksheet
   ActiveSheet.Range("a1:f1").Select
   Selection.Copy
   On Error Resume Next
   Application.ScreenUpdating = False
   For Each WS In Worksheets
      WS.Columns("A:F").Sort Key1:=WS.Columns("E"), Order1:=xlDescending
   Next WS
   ActiveSheet.Range("A1").PasteSpecial Paste:=xlPasteAll
   Application.ScreenUpdating = True
End Sub

3. Στη συνέχεια πατήστε F5 κλειδί για την εκτέλεση αυτού του κώδικα, όλα τα φύλλα που έχουν την ίδια μορφοποίηση έχουν ταξινομηθεί με βάση τη στήλη Ε κάθε φύλλου σε φθίνουσα σειρά ταυτόχρονα.

Note: Στον παραπάνω κώδικα, A: F είναι το εύρος δεδομένων που θέλετε να ταξινομήσετε, E είναι το γράμμα στήλης στο οποίο θέλετε να ταξινομήσετε βάσει.

Τα καλύτερα εργαλεία παραγωγικότητας γραφείου

🤖 Kutools AI Aide: Επανάσταση στην ανάλυση δεδομένων με βάση: Ευφυής Εκτέλεση   |  Δημιουργία κώδικα  |  Δημιουργία προσαρμοσμένων τύπων  |  Αναλύστε δεδομένα και δημιουργήστε γραφήματα  |  Επίκληση Λειτουργιών Kutools...
Δημοφιλή χαρακτηριστικά: Εύρεση, επισήμανση ή αναγνώριση διπλότυπων   |  Διαγραφή κενών γραμμών   |  Συνδυάστε στήλες ή κελιά χωρίς απώλεια δεδομένων   |   Γύρος χωρίς φόρμουλα ...
Σούπερ Αναζήτηση: VLookup πολλαπλών κριτηρίων    VLookup πολλαπλών τιμών  |   VLookup σε πολλά φύλλα   |   Ασαφής αναζήτηση ....
Σύνθετη αναπτυσσόμενη λίστα: Γρήγορη δημιουργία αναπτυσσόμενης λίστας   |  Εξαρτημένη αναπτυσσόμενη λίστα   |  Πολλαπλή αναπτυσσόμενη λίστα ....
Διαχειριστής στήλης: Προσθέστε έναν συγκεκριμένο αριθμό στηλών  |  Μετακίνηση στηλών  |  Εναλλαγή κατάστασης ορατότητας κρυφών στηλών  |  Συγκρίνετε εύρη και στήλες ...
Επιλεγμένα Χαρακτηριστικά: Εστίαση πλέγματος   |  Προβολή σχεδίου   |   Μεγάλη Formula Bar    Διαχείριση βιβλίου εργασίας & φύλλου   |  Βιβλιοθήκη πόρων (Αυτόματο κείμενο)   |  Επιλογή ημερομηνίας   |  Συνδυάστε φύλλα εργασίας   |  Κρυπτογράφηση/Αποκρυπτογράφηση κελιών    Αποστολή email ανά λίστα   |  Σούπερ φίλτρο   |   Ειδικό φίλτρο (φίλτρο με έντονη γραφή/πλάγια γραφή/διαγραφή...) ...
Κορυφαία 15 σύνολα εργαλείων12 Κείμενο Εργαλεία (Προσθήκη κειμένου, Κατάργηση χαρακτήρων, ...)   |   50 + Διάγραμμα Τύποι (Gantt διάγραμμα, ...)   |   40+ Πρακτικό ΜΑΘΗΜΑΤΙΚΟΙ τυποι (Υπολογίστε την ηλικία με βάση τα γενέθλια, ...)   |   19 Εισαγωγή Εργαλεία (Εισαγωγή κωδικού QR, Εισαγωγή εικόνας από το μονοπάτι, ...)   |   12 Μετατροπή Εργαλεία (Αριθμοί σε λέξεις, Μετατροπή Συναλλάγματος, ...)   |   7 Συγχώνευση & διαχωρισμός Εργαλεία (Σύνθετες σειρές συνδυασμού, Διαίρεση κελιών, ...)   |   ... κι αλλα

Αυξήστε τις δεξιότητές σας στο Excel με τα Kutools για Excel και απολαύστε την αποτελεσματικότητα όπως ποτέ πριν. Το Kutools για Excel προσφέρει πάνω από 300 προηγμένες δυνατότητες για την ενίσχυση της παραγωγικότητας και την εξοικονόμηση χρόνου.  Κάντε κλικ εδώ για να αποκτήσετε τη δυνατότητα που χρειάζεστε περισσότερο...

Περιγραφή


Το Office Tab φέρνει τη διεπαφή με καρτέλες στο Office και κάνει την εργασία σας πολύ πιο εύκολη

  • Ενεργοποίηση επεξεργασίας και ανάγνωσης καρτελών σε Word, Excel, PowerPoint, Publisher, Access, Visio και Project.
  • Ανοίξτε και δημιουργήστε πολλά έγγραφα σε νέες καρτέλες του ίδιου παραθύρου και όχι σε νέα παράθυρα.
  • Αυξάνει την παραγωγικότητά σας κατά 50% και μειώνει εκατοντάδες κλικ του ποντικιού για εσάς κάθε μέρα!
Comments (11)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
This didn't seem to work for me. I have a workbook with 12 sheets ordered by months of the year each sheet containing corresponding data regarding companies products etc. My objective is to sort and filter the all the sheets in the workbook. I would like to have one sheet that would act as the parent sheet (e.g. first month of the year), which I would perform a filter or sort function on (e.g. A -> Z sort) and automatically have the other sheets follow the same sort or filter. For example, when using the sheet labeled "January" if for example I choose column "D" which includes the days in the month which I want in "ascending" order - when actualizing the A -> Z sort on the "January" sheet, I want this to effect the rest of all the sheets in the sequence (Feb-Dec) with all days of the month sorted A -> Z. Any change made on the "January" sheet as it relates to sorting and filtering, should effect the balance of the sheets in the workbook.
This comment was minimized by the moderator on the site
Can you run this without including all sheets? I.e. leave some sheets out of the macro?
This comment was minimized by the moderator on the site
i want to split the data in multiple work books and then add the value in one of the column..

i have prepared the code to split the data in workbooks.. but need help on adding the total in one of the column
This comment was minimized by the moderator on the site
works well but how can I avoid including the headings (ie row 1?)
This comment was minimized by the moderator on the site
Hello, Lucy,
To sort all sheets exclude the header row, please apply the below vba code:(Note: please change the cell references to your need)

Sub SortAllSheets()
'Updateby Extendoffice
Dim WS As Worksheet
Dim xIntR As Integer
ActiveSheet.Range("A1:F1").Select
On Error Resume Next
Application.ScreenUpdating = False
For Each WS In Worksheets
xIntR = Intersect(WS.UsedRange, WS.Range("A:F")).Rows.Count
WS.Range("A2:F" & xIntR).Sort Key1:=WS.Range("A2:A" & xIntR), Order1:=xlDescending
Next WS
Application.ScreenUpdating = True
End Sub

Please try, hope it can help you!
This comment was minimized by the moderator on the site
Hey this is great thank you so much for this! My only issue with this code is that it does not execute on my first sheet. It does execute on my remaining sheets. HOw would I get this to execute on all of the sheets? It's as if the code skips over the first sheet. Any help would be much appreciated :)
This comment was minimized by the moderator on the site
Very usefull code Thanks
This comment was minimized by the moderator on the site
In the hope that you see this...! This works wonderfully - but it includes cells with a formula but no data, creating gaps in the tabs and messing up the data on the rows. I need to keep those cells in my tabs as they look up names added to the 'master tab' I want it to only sort cells with an actual name - a quick fix???
This comment was minimized by the moderator on the site
worked like a charm for me...thank you!
This comment was minimized by the moderator on the site
Doesn't work...
This comment was minimized by the moderator on the site
How can I make this work for multiple columns. I am trying to sort some by the K column and some by the M column and I know the exact sheet numbers. My M column (when I use the above code) is only being sorted by the K, not by M, so therefore it is not working. 
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations