- Katılım
- 26 Ocak 2007
- Mesajlar
- 4,625
- Excel Vers. ve Dili
- Ofis 2016
- Altın Üyelik Bitiş Tarihi
- 20-02-2025
DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
kulomer46 üstadım çok teşekkür ederim. Harika bir kod, sağlıcakla kalınMerhaba
Ekli dosya taleplerinizi karşılayabilir.
Selamlar...
İlgili resim
Ekli dosyayı görüntüle 222102
Kolay gelsin..kulomer46 üstadım çok teşekkür ederim. Harika bir kod, sağlıcakla kalın
üstad geçerkten çok harika bir çalışma, elinize sağlık. acaba kontrol yönünü yukarıdan aşağıya yapmak için kodu nasıl revize etmeliyimKolay gelsin..
Option Explicit
Sub En_Yakini_Bul()
Dim Son As Long, Aranan As String, Yeni_Aranan As String
Dim Bul As Range, X As Integer, WF As WorksheetFunction
Set WF = WorksheetFunction
Son = Cells(Rows.Count, 2).End(3).Row
Aranan = Cells(Son, 2).Value
Set Bul = Range("B:B").Find(Aranan, , , xlWhole)
If Not Bul Is Nothing Then
If Bul.Row <> Son Then
MsgBox "Aranan veri " & Bul.Row & ". satırda bulundu!" & vbLf & vbLf & Bul.Value, vbExclamation
Exit Sub
Else
Yeni_Aranan = "?" & Left(Aranan, Len(Aranan) - 1)
Set Bul = Range("B:B").Find(Yeni_Aranan, , , xlWhole)
If Not Bul Is Nothing Then
If Bul.Row <> Son Then
MsgBox "Aranan veri " & Bul.Row & ". satırda bulundu!" & vbLf & vbLf & Bul.Value, vbExclamation
Exit Sub
End If
End If
Yeni_Aranan = Right(Aranan, Len(Aranan) - 1) & "?"
Set Bul = Range("B:B").Find(Yeni_Aranan, , , xlWhole)
If Not Bul Is Nothing Then
If Bul.Row <> Son Then
MsgBox "Aranan veri " & Bul.Row & ". satırda bulundu!" & vbLf & vbLf & Bul.Value, vbExclamation
Exit Sub
End If
End If
For X = 1 To Len(Aranan)
Yeni_Aranan = WF.Replace(Aranan, X, 1, "?")
Set Bul = Range("B:B").Find(Yeni_Aranan, , , xlWhole)
If Not Bul Is Nothing Then
If Bul.Row <> Son Then
MsgBox "Aranan veri " & Bul.Row & ". satırda bulundu!" & vbLf & vbLf & Bul.Value, vbExclamation
Exit Sub
End If
End If
Next
End If
End If
Set Bul = Nothing
Set WF = Nothing
MsgBox "En yakın eşleşme bulunamadı!", vbCritical
End Sub
Üstad çok teşekkür ediyorum. elinize sağlık.Alternatif;
C++:Option Explicit Sub En_Yakini_Bul() Dim Son As Long, Aranan As String, Yeni_Aranan As String Dim Bul As Range, X As Integer, WF As WorksheetFunction Set WF = WorksheetFunction Son = Cells(Rows.Count, 2).End(3).Row Aranan = Cells(Son, 2).Value Set Bul = Range("B:B").Find(Aranan, , , xlWhole) If Not Bul Is Nothing Then If Bul.Row <> Son Then MsgBox "Aranan veri " & Bul.Row & ". satırda bulundu!" & vbLf & vbLf & Bul.Value, vbExclamation Exit Sub Else Yeni_Aranan = "?" & Left(Aranan, Len(Aranan) - 1) Set Bul = Range("B:B").Find(Yeni_Aranan, , , xlWhole) If Not Bul Is Nothing Then If Bul.Row <> Son Then MsgBox "Aranan veri " & Bul.Row & ". satırda bulundu!" & vbLf & vbLf & Bul.Value, vbExclamation Exit Sub End If End If Yeni_Aranan = Right(Aranan, Len(Aranan) - 1) & "?" Set Bul = Range("B:B").Find(Yeni_Aranan, , , xlWhole) If Not Bul Is Nothing Then If Bul.Row <> Son Then MsgBox "Aranan veri " & Bul.Row & ". satırda bulundu!" & vbLf & vbLf & Bul.Value, vbExclamation Exit Sub End If End If For X = 2 To Len(Aranan) Yeni_Aranan = WF.Replace(Aranan, X, 1, "?") Set Bul = Range("B:B").Find(Yeni_Aranan, , , xlWhole) If Not Bul Is Nothing Then If Bul.Row <> Son Then MsgBox "Aranan veri " & Bul.Row & ". satırda bulundu!" & vbLf & vbLf & Bul.Value, vbExclamation Exit Sub End If End If Next End If End If Set Bul = Nothing Set WF = Nothing MsgBox "En yakın eşleşme bulunamadı!", vbCritical End Sub
Option Explicit
Sub En_Yakini_Bul()
Dim Aranan As String, Yeni_Aranan As String
Dim Bul As Range, X As Integer, WF As WorksheetFunction
Set WF = WorksheetFunction
Aranan = Cells(1, 2).Value
Set Bul = Range("B:B").Find(Aranan, , , xlWhole)
If Not Bul Is Nothing Then
If Bul.Row <> 1 Then
MsgBox "Aranan veri " & Bul.Row & ". satırda bulundu!" & vbLf & vbLf & Bul.Value, vbExclamation
Exit Sub
Else
Yeni_Aranan = "?" & Left(Aranan, Len(Aranan) - 1)
Set Bul = Range("B:B").Find(Yeni_Aranan, , , xlWhole)
If Not Bul Is Nothing Then
If Bul.Row <> 1 Then
MsgBox "Aranan veri " & Bul.Row & ". satırda bulundu!" & vbLf & vbLf & Bul.Value, vbExclamation
Exit Sub
End If
End If
Yeni_Aranan = Right(Aranan, Len(Aranan) - 1) & "?"
Set Bul = Range("B:B").Find(Yeni_Aranan, , , xlWhole)
If Not Bul Is Nothing Then
If Bul.Row <> 1 Then
MsgBox "Aranan veri " & Bul.Row & ". satırda bulundu!" & vbLf & vbLf & Bul.Value, vbExclamation
Exit Sub
End If
End If
For X = 1 To Len(Aranan)
Yeni_Aranan = WF.Replace(Aranan, X, 1, "?")
Set Bul = Range("B:B").Find(Yeni_Aranan, , , xlWhole)
If Not Bul Is Nothing Then
If Bul.Row <> 1 Then
MsgBox "Aranan veri " & Bul.Row & ". satırda bulundu!" & vbLf & vbLf & Bul.Value, vbExclamation
Exit Sub
End If
End If
Next
End If
End If
Set Bul = Nothing
Set WF = Nothing
MsgBox "En yakın eşleşme bulunamadı!", vbCritical
End Sub
Çok teşekkür ederim üstadım, emeğiniz sağlık. Bu şekilde gayet iyi çalışıyor.
Çok teşekkür ederim üstadım, emeğiniz sağlık. Bu şekilde gayet iyi çalışıyor.Ben de kendi paylaştığım kodu aşağıdaki gibi revize ettim. Deneyin bakalım istediğiniz sonucu verecek mi?
C++:Option Explicit Sub En_Yakini_Bul() Dim Aranan As String, Yeni_Aranan As String Dim Bul As Range, X As Integer, WF As WorksheetFunction Set WF = WorksheetFunction Aranan = Cells(1, 2).Value Set Bul = Range("B:B").Find(Aranan, , , xlWhole) If Not Bul Is Nothing Then If Bul.Row <> 1 Then MsgBox "Aranan veri " & Bul.Row & ". satırda bulundu!" & vbLf & vbLf & Bul.Value, vbExclamation Exit Sub Else Yeni_Aranan = "?" & Left(Aranan, Len(Aranan) - 1) Set Bul = Range("B:B").Find(Yeni_Aranan, , , xlWhole) If Not Bul Is Nothing Then If Bul.Row <> 1 Then MsgBox "Aranan veri " & Bul.Row & ". satırda bulundu!" & vbLf & vbLf & Bul.Value, vbExclamation Exit Sub End If End If Yeni_Aranan = Right(Aranan, Len(Aranan) - 1) & "?" Set Bul = Range("B:B").Find(Yeni_Aranan, , , xlWhole) If Not Bul Is Nothing Then If Bul.Row <> 1 Then MsgBox "Aranan veri " & Bul.Row & ". satırda bulundu!" & vbLf & vbLf & Bul.Value, vbExclamation Exit Sub End If End If For X = 1 To Len(Aranan) Yeni_Aranan = WF.Replace(Aranan, X, 1, "?") Set Bul = Range("B:B").Find(Yeni_Aranan, , , xlWhole) If Not Bul Is Nothing Then If Bul.Row <> 1 Then MsgBox "Aranan veri " & Bul.Row & ". satırda bulundu!" & vbLf & vbLf & Bul.Value, vbExclamation Exit Sub End If End If Next End If End If Set Bul = Nothing Set WF = Nothing MsgBox "En yakın eşleşme bulunamadı!", vbCritical End Sub