NADİR YILDIZ
Altın Üye
- Katılım
- 7 Ocak 2006
- Mesajlar
- 1,418
- Excel Vers. ve Dili
- 2016 Türkçe
DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Sub SarıDolguluSatırlarıKopyala()
Dim wsZirve As Worksheet
Dim wsBenzerOlanlar As Worksheet
Dim lastRow As Long
Dim i As Long
Dim j As Long
Set wsZirve = ThisWorkbook.Worksheets("Zirve")
Set wsBenzerOlanlar = ThisWorkbook.Worksheets("BENZER OLANLAR")
lastRow = wsZirve.Cells(wsZirve.Rows.Count, "A").End(xlUp).Row
For i = 1 To lastRow
If wsZirve.Cells(i, "A").Interior.ColorIndex = 6 Then ' 6, sarı renk kodudur
j = wsBenzerOlanlar.Cells(wsBenzerOlanlar.Rows.Count, "A").End(xlUp).Row + 1
wsZirve.Range("A" & i & ":N" & i).Copy wsBenzerOlanlar.Range("A" & j)
End If
Next i
MsgBox "Sarı dolgulu satırlar kopyalandı."
End Sub
Sub Makro1_VeriBirlestir()
Dim ws As Worksheet
Dim birlesmisVeri As String
Dim satir As Integer
Set ws = ThisWorkbook.Sheets("Zirve")
For satir = 2 To ws.Cells(Rows.Count, "A").End(xlUp).Row
birlesmisVeri = ws.Range("A" & satir).Value & _
ws.Range("B" & satir).Value & _
ws.Range("F" & satir).Value & _
ws.Range("H" & satir).Value & _
ws.Range("J" & satir).Value & _
ws.Range("K" & satir).Value
ws.Range("Z" & satir).Value = birlesmisVeri
Next satir
Call Makro2_YinelenenleriRenklendir
Call Makro3_BenzerSayfasinaTasi
End Sub
Sub Makro2_YinelenenleriRenklendir()
Dim ws As Worksheet
Dim rng As Range
Dim cel As Range
Set ws = ThisWorkbook.Sheets("Zirve")
Set rng = ws.Range("Z1:Z" & ws.Cells(Rows.Count, "Z").End(xlUp).Row)
For Each cel In rng
If WorksheetFunction.CountIf(rng, cel.Value) > 1 Then
cel.Interior.Color = vbYellow
End If
Next cel
End Sub
Sub Makro3_BenzerSayfasinaTasi()
Dim wsZirve As Worksheet
Dim wsBenzerOlanlar As Worksheet
Dim lastRow As Long
Dim i As Long
Dim j As Long
Set wsZirve = ThisWorkbook.Worksheets("Zirve")
Set wsBenzerOlanlar = ThisWorkbook.Worksheets("BENZER OLANLAR")
lastRow = wsZirve.Cells(wsZirve.Rows.Count, "A").End(xlUp).Row
For i = 1 To lastRow
If wsZirve.Cells(i, "Z").Interior.ColorIndex = 6 Then ' 6, sarı renk kodudur
j = wsBenzerOlanlar.Cells(wsBenzerOlanlar.Rows.Count, "A").End(xlUp).Row + 1
wsZirve.Range("A" & i & ":N" & i).Copy wsBenzerOlanlar.Range("A" & j)
End If
Next i
MsgBox "Yinelenen satırlar aktarıldı."
Sheets("Zirve").Range("Z2:Z" & lastRow).Clear
End Sub
Call Makro3_BenzerSayfasinaTasi satırından sonraCall Makro4_BenzerOlmayanSayfasinaTasi satırını ekleyin.Sub Makro4_BenzerOlmayanSayfasinaTasi()
Dim wsZirve As Worksheet
Dim wsBenzerOlanlar As Worksheet
Dim lastRow As Long
Dim i As Long
Dim j As Long
Set wsZirve = ThisWorkbook.Worksheets("Zirve")
Set wsBenzerOlanlar = ThisWorkbook.Worksheets("BENZER OLMAYANLAR")
lastRow = wsZirve.Cells(wsZirve.Rows.Count, "A").End(xlUp).Row
For i = 2 To lastRow
If wsZirve.Cells(i, "Z").Interior.ColorIndex = xlNone Then
j = wsBenzerOlanlar.Cells(wsBenzerOlanlar.Rows.Count, "A").End(xlUp).Row + 1
wsZirve.Range("A" & i & ":N" & i).Copy wsBenzerOlanlar.Range("A" & j)
End If
Next i
MsgBox "Satırlar aktarıldı."
Sheets("Zirve").Range("Z2:Z" & lastRow).Clear
End Sub
Option Explicit
Sub List_Duplicate_And_Non_Duplicate_Records_On_Separate_Pages()
Dim My_Connection As Object, My_Query As String
Dim My_Recordset As Object, Process_Time As Double
Process_Time = Timer
Set My_Connection = CreateObject("AdoDB.Connection")
My_Connection.Open "Provider=Microsoft.Ace.OleDb.12.0;Data Source=" & _
ThisWorkbook.FullName & ";Extended Properties=""Excel 12.0;Hdr=No"""
My_Query = "SELECT * FROM [Zirve$A2:N] WHERE F1&F2&F6&F8&F10& IIF(F11=0,F12,F11) " & _
"IN (SELECT F1&F2&F6&F8&F10 & IIF(F11=0,F12,F11) FROM [Zirve$A2:N] " & _
"GROUP BY F1,F2,F6,F8,F10,IIF(F11=0,F12,F11) HAVING COUNT(*) > 1)"
Set My_Recordset = My_Connection.Execute(My_Query)
Sheets("BENZER OLANLAR").Range("A2:N" & Rows.Count).ClearContents
Sheets("BENZER OLANLAR").Range("A2").CopyFromRecordset My_Recordset
My_Query = "SELECT * FROM [Zirve$A2:N] WHERE F1&F2&F6&F8&F10& IIF(F11=0,F12,F11) " & _
"IN (SELECT F1&F2&F6&F8&F10 & IIF(F11=0,F12,F11) FROM [Zirve$A2:N] " & _
"GROUP BY F1,F2,F6,F8,F10,IIF(F11=0,F12,F11) HAVING COUNT(*) = 1)"
Set My_Recordset = My_Connection.Execute(My_Query)
Sheets("BENZER OLMAYANLAR").Range("A2:N" & Rows.Count).ClearContents
Sheets("BENZER OLMAYANLAR").Range("A2").CopyFromRecordset My_Recordset
If My_Recordset.State <> 0 Then My_Recordset.Close
If My_Connection.State <> 0 Then My_Connection.Close
Set My_Recordset = Nothing
Set My_Connection = Nothing
MsgBox "İşleminiz tamamlanmıştır." & vbCrLf & _
"İşlem süresi ; " & Format(Timer - Process_Time, "0.00") & " Saniye"
End Sub