Ana içeriğe atla

Yinelenen satırları Excel'de başka bir sayfaya nasıl taşıyabilirim?

Belirli bir sütunda bazı yinelenen değerler içeren bir veri aralığı listeniz varsa, şimdi tüm satırları yinelenen hücrelere göre başka bir sayfaya taşımak istiyorsunuz. Excel'de bu görevle nasıl başa çıkabilirsiniz?

Bir sütundaki yinelenen hücrelere dayalı olarak tüm satırları başka bir sayfaya taşıma

Yinelenen satırlara göre tüm satırları başka bir sayfaya taşıyın


Bir sütundaki yinelenen hücrelere dayalı olarak tüm satırları başka bir sayfaya taşıma

Bir sütunda yinelenen değerler varsa, tüm satırları başka bir sayfaya taşıyın, aşağıdaki VBA kodu size bir iyilik yapabilir:

1. Basılı tutun ALT + F11 tuşlarını açmak için Uygulamalar için Microsoft Visual Basic pencere.

2. tıklayın Ekle > modülve aşağıdaki kodu Modül penceresine yapıştırın.

VBA kodu: Bir sütundaki yinelenen hücrelere göre satırların tamamını başka bir sayfaya taşıyın:

Sub CutDuplicates()
'Updateby Extendoffice
    Dim xRgS As Range
    Dim xRgD As Range
    Dim I As Long, J As Long
    On Error Resume Next
    Set xRgS = Application.InputBox("Please select the column:", "KuTools For Excel", Selection.Address, , , , , 8)
    If xRgS Is Nothing Then Exit Sub
    Set xRgD = Application.InputBox("Please select a desitination cell:", "KuTools For Excel", , , , , , 8)
    If xRgD Is Nothing Then Exit Sub
    xRows = xRgS.Rows.Count
    J = 0
    For I = xRows To 1 Step -1
        If Application.WorksheetFunction.CountIf(xRgS, xRgS(I)) > 1 Then
            xRgS(I).EntireRow.Copy xRgD.Offset(J, 0)
            xRgS(I).EntireRow.Delete
            J = J + 1
        End If
    Next
End Sub

3. Daha sonra tuşuna basın. F5 Bu kodu çalıştırmak için tuşuna basın ve açılan iletişim kutusunda, taşımak istediğiniz yinelenen hücreleri içeren sütunu seçin, ekran görüntüsüne bakın:

4. Sonra tıklayın OK, başka bir istem kutusunda, lütfen taşınan satırları koymak istediğiniz başka bir sayfada bir hücre seçin, ekran görüntüsüne bakın:

5. Ve sonra tıklayın OK, A sütununda yinelenen değerlere sahip satırlar yeni bir sayfaya taşındı, ekran görüntüsüne bakın:


Yinelenen satırlara göre tüm satırları başka bir sayfaya taşıyın

Yinelenen satırları bir hücre aralığından taşımak istiyorsanız, aşağıdaki VBA kodu size yardımcı olabilir:

1. Basılı tutun ALT + F11 tuşlarını açmak için Uygulamalar için Microsoft Visual Basic pencere.

2. tıklayın Ekle > modülve aşağıdaki kodu Modül penceresine yapıştırın.

VBA kodu: Tüm satırları, yinelenen satırlara göre başka bir sayfaya taşıyın:

Sub CutDuplicates()
'Updateby Extendoffice
    Dim xRgD As Range, xRgS As Range
    Dim I As Long, J As Long, K As Long, KK As Long
    On Error Resume Next
    Set xRgS = Application.InputBox("Please select the data range:", "KuTools For Excel", Selection.Address, , , , , 8)
    If xRgS Is Nothing Then Exit Sub
    Set xRgD = Application.InputBox("Please select a desitination cell:", "KuTools For Excel", , , , , , 8)
    If xRgD Is Nothing Then Exit Sub
    KK = 0
    For I = xRgS.Rows.Count To 1 Step -1
        For J = 1 To I - 1
            For K = 1 To xRgS.Columns.Count
                Debug.Print xRgS.Rows(I).Cells(, K).Value
                Debug.Print xRgS.Rows(J).Cells(, K).Value
                If xRgS.Rows(I).Cells(, K).Value <> xRgS.Rows(J).Cells(, K).Value Then Exit For
            Next
            If K = xRgS.Columns.Count + 1 Then
                xRgS.Rows(I).EntireRow.Copy xRgD.Offset(KK, 0).EntireRow
                xRgS.Rows(I).EntireRow.Delete
                KK = KK + 1
            End If
        Next
    Next
End Sub

3. Daha sonra tuşuna basın. F5 Bu kodu çalıştırmak için anahtar, açılan iletişim kutusunda, yinelenen satırları taşımak istediğiniz veri aralığını seçin, ekran görüntüsüne bakın:

4. tıklayın OK düğmesini ve ardından başka bir istem kutusunda, taşınan ek satırları yerleştirmek istediğiniz yeni bir sayfada bir hücre seçin, ekran görüntüsüne bakın:

5. Sonra tıklayın OK düğmesi ve şimdi, yinelenen satırlar aynı anda belirttiğiniz başka bir sayfaya taşındı, ekran görüntüsüne bakın:

En İyi Ofis Üretkenlik Araçları

🤖 Kutools AI Yardımcısı: Aşağıdakilere dayalı olarak veri analizinde devrim yaratın: Akıllı Yürütme   |  Kodunu oluşturun  |  Özel Formüller Oluşturun  |  Verileri Analiz Edin ve Grafikler Oluşturun  |  Kutools İşlevlerini Çağır...
Popüler Özellikler: Yinelenenleri Bul, Vurgula veya Tanımla   |  Boş Satırları Sil   |  Veri Kaybı Olmadan Sütunları veya Hücreleri Birleştirin   |   Formülsüz Tur ...
Süper Arama: Çoklu Ölçütlü VLookup    Çoklu Değer VLookup  |   Birden Çok Sayfada VLookup   |   Bulanık Arama ....
Gelişmiş Açılır Liste: Hızla Açılır Liste Oluşturun   |  Bağımlı Açılır Liste   |  Çoklu Seçim Açılır Liste ....
Sütun Yöneticisi: Belirli Sayıda Sütun Ekleme  |  Sütunları Taşı  |  Gizli Sütunların Görünürlük Durumunu Değiştir  |  Aralıkları ve Sütunları Karşılaştırın ...
Öne Çıkan Özellikler: Izgara Odağı   |  Tasarım görünümü   |   Büyük Formül Çubuğu    Çalışma Kitabı ve Sayfa Yöneticisi   |  Kaynak Kütüphanesi (Otomatik metin)   |  Tarih Seçici   |  Çalışma Sayfalarını Birleştirin   |  Hücreleri Şifrele/Şifresini Çöz    E-postaları Listeye Göre Gönder   |  Süper Filtre   |   Özel Filtre (kalın/italik/üstü çizili filtre...) ...
En İyi 15 Araç Seti12 Metin Tools (Metin ekle, Karakterleri Kaldır, ...)   |   50+ Grafik Türleri (Gantt şeması, ...)   |   40+ Pratik Formüller (Yaşı doğum gününe göre hesapla, ...)   |   19 sokma Tools (QR Kodunu Girin, Yoldan Resim Ekle, ...)   |   12 Dönüştürme Tools (Sayılardan Kelimelere, Para Birimi Dönüştürme, ...)   |   7 Birleştir ve Böl Tools (Gelişmiş Kombine Satırları, Bölünmüş hücreler, ...)   |   ... ve dahası

Kutools for Excel ile Excel Becerilerinizi Güçlendirin ve Daha Önce Hiç Olmadığı Gibi Verimliliği Deneyimleyin. Kutools for Excel, Üretkenliği Artırmak ve Zamandan Tasarruf Etmek için 300'den Fazla Gelişmiş Özellik Sunar.  En Çok İhtiyacınız Olan Özelliği Almak İçin Buraya Tıklayın...

Açıklama


Office Tab, Office'e Sekmeli Arayüz Getirir ve İşinizi Çok Daha Kolay Hale Getirir

  • Word, Excel, PowerPoint'te sekmeli düzenlemeyi ve okumayı etkinleştirin, Publisher, Access, Visio ve Project.
  • Yeni pencereler yerine aynı pencerenin yeni sekmelerinde birden çok belge açın ve oluşturun.
  • Üretkenliğinizi% 50 artırır ve her gün sizin için yüzlerce fare tıklamasını azaltır!
Comments (6)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hola buenas,

Tenia una pregunta con respecto a esta macro; Esta macro es exactamente lo que necesito y funciona perfectamente, pero mi problema es que solo funciona en grupo de datos que no sean muy grandes.

Cuando la aplico sobre un grupo de datos grandes (en mi caso, 50mil filas), excel inevitablemente colapsa; He probado muchas cosas pero sigue colapsando.

Hay alguna manera de hacer que la macro funcione en estos casos? alguna idea? Gracias de antemano.

Rafael.
This comment was minimized by the moderator on the site
Hello, Rafael

Yes, as you said, if the data is large, the vba code will not work perfectly. In this case, you can use the auxiliary column to mark the duplicate row first, then use the filter function to filter out the duplicate row, finally copy the duplicate row to another worksheet. Please see the below demo:
To find the duplicate rows, please apply this formula: =IF(COUNTIFS($A$2:$A2,$A2,$B$2:$B2,$B2,$C$2:$C2,$C2) >1, "Duplicate row", "")
If you just want to find the duplicate cells in one column, please apply this formula: =IF(COUNTIFS($A$2:$A2,$A2) >1, "Duplicate row", "")
https://www.extendoffice.com/images/stories/comments/comment-skyyang/move-duplicates.gif
Please have a try, hope it can help you!
This comment was minimized by the moderator on the site
Hola, que tal,

Tengo una duda con respecto a esta macro; La macro funciona perfectamente y es justo lo que necesito, el problema es que habitualmente necesito utilizarla con tablas de excel en las que hay como mas de 50 mil entradas.

Al utilizarla, Excel inevitablemente se colapsa y no responde.

Hay alguna manera de conseguir que esta macro funcione en estos casos? O quizas, conseguir alguna formula/combinacion de formulas en excel que haga lo mismo? Lo comento porque en el caso de las formulas, normalmente excel no suele tardar tanto en procesar y lo resuelve mas rapido.

Un saludo, y gracias.

Rafael.
This comment was minimized by the moderator on the site
For some reason. This worked once, but I cant run it again. IT keeps timing out. Any tips?
This comment was minimized by the moderator on the site
It's working bro!!!!! Thanks.
This comment was minimized by the moderator on the site
This is exactly what I was looking for, thank you! I did it wrong the first few times and then it kept freezing. But once I did it exactly like the screenshots (selecting the exact range, copy/pasting the headers in the other sheet, and only selecting the first field under the first header) the macros was instantaneous.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations