DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Sub ilkfiltre()
Set s1 = ActiveSheet
son = Cells(Rows.Count, "A").End(3).Row
Range("A1:A" & son).Copy
Sheets.Add After:=ActiveSheet
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Set s2 = ActiveSheet
ActiveSheet.Range("$A$1:$A$" & son).RemoveDuplicates Columns:=1, Header:=xlNo
s1.Select
ActiveSheet.Range("$A$1:$T$" & son).AutoFilter Field:=1, Criteria1:= _
s2.[A2]
End Sub
Sub ilkfiltre()
Set s1 = ActiveSheet
son = Cells(Rows.Count, "A").End(3).Row
Range("A1:A" & son).Copy
Sheets.Add After:=ActiveSheet
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Set s2 = ActiveSheet
ActiveSheet.Range("$A$1:$A$" & son).RemoveDuplicates Columns:=1, Header:=xlNo
ActiveSheet.Sort.SortFields.Add2 Key:=Range( _
"A2:A" & son), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveSheet.Sort
.SetRange Range("A1:A" & son)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
s1.Select
ActiveSheet.Range("$A$1:$T$" & son).AutoFilter Field:=1, Criteria1:= _
s2.[A2]
Application.DisplayAlerts = False
s2.Delete
Application.DisplayAlerts = True
End Sub
Option Explicit
Sub Filtre_Ogeleri()
Dim Baglanti As Object, Kayit_Seti As Object, Sorgu As String, Liste As Variant
If WorksheetFunction.CountA(Range("A2:A" & Rows.Count)) = 0 Then
MsgBox "Uygun veri bulunamadı!", vbExclamation
Exit Sub
End If
Set Baglanti = CreateObject("Adodb.Connection")
Set Kayit_Seti = CreateObject("Adodb.Recordset")
Baglanti.Open "Provider=Microsoft.Ace.OleDb.12.0;Data Source=" & _
ThisWorkbook.FullName & ";Extended Properties=""Excel 12.0;Hdr=No"""
Sorgu = "Select Distinct F1 From [Sayfa1$A2:A] Order By F1 Asc"
Kayit_Seti.Open Sorgu, Baglanti, 1, 1
If Kayit_Seti.RecordCount > 0 Then
Liste = Kayit_Seti.GetRows
MsgBox "Filtre listesinin 1. öğesi ; " & Liste(0, 0) & vbCr & "Filtre listesinin 3. öğesi ; " & Liste(0, 2)
End If
If Kayit_Seti.State <> 0 Then Kayit_Seti.Close
If Baglanti.State <> 0 Then Baglanti.Close
Set Baglanti = Nothing
Set Kayit_Seti = Nothing
End Sub
Option Explicit
Sub Filtre_Ogeleri()
Dim Dizi As Object, Veri As Variant, Son As Long, X As Long
Set Dizi = CreateObject("System.Collections.ArrayList")
Son = Cells(Rows.Count, 1).End(3).Row
If Son < 2 Then Son = 3
Veri = Range("A2:A" & Son).Value
For X = LBound(Veri, 1) To UBound(Veri, 1)
If Veri(X, 1) <> "" Then
If Not Dizi.Contains(Veri(X, 1)) Then Dizi.Add Veri(X, 1)
End If
Next
If Dizi.Count > 0 Then
Dizi.Sort
MsgBox "Filtre listesinin 1. öğesi ; " & Dizi.Item(0) & vbCr & "Filtre listesinin 3. öğesi ; " & Dizi.Item(2)
Else
MsgBox "Uygun veri bulunamadı!", vbExclamation
End If
Set Dizi = Nothing
End Sub