Merhaba,
Aradığım bir kelimenin excel dosyasındaki tüm satırları bulup, bulunan satırlardaki bir kaç sütündeki veriyi başka bir excel tablosunda sıralayıp aktarmaya çalıştım.
Forumda arama sonucu aşağıdaki kodları yazarak, arama yaptığım kelimenin tüm satılarını listeledim, fakat bu satırların diğer sütün bilgilerini getiremedim. Yardımcı olur musunuz?
Sub BulListele()
Dim c As Range, Adr As Variant, sat As Long, sonhcr As Range
Dim i As Integer, adres As String
Sheets("Arama").Select
If Range("A1") = "" Then MsgBox "A1 Hücresine Aranacak Değeri Girin'": Exit Sub
sat = 2: Range("A" & sat, "A" & Rows.Count).ClearContents
For i = 1 To Worksheets.Count
If Not Sheets(i).Name = "Arama" Then
With Sheets(i).Cells
Set sonhcr = .Cells(.Rows.Count)
Set c = .Find(Range("A1"), sonhcr, xlValues, xlWhole)
If Not c Is Nothing Then
Adr = c.Address
Do
adres = Sheets(i).Name & "!" & c.Address
ActiveSheet.Cells(sat, "A").Value = Cells(1, 1).Value
sat = sat + 1
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> Adr
End If
End With
End If
Next i
Set sonhcr = Nothing: Set c = Nothing
MsgBox "Listeleme Tamam!", , "Deneme"
End Sub
Aradığım bir kelimenin excel dosyasındaki tüm satırları bulup, bulunan satırlardaki bir kaç sütündeki veriyi başka bir excel tablosunda sıralayıp aktarmaya çalıştım.
Forumda arama sonucu aşağıdaki kodları yazarak, arama yaptığım kelimenin tüm satılarını listeledim, fakat bu satırların diğer sütün bilgilerini getiremedim. Yardımcı olur musunuz?
Sub BulListele()
Dim c As Range, Adr As Variant, sat As Long, sonhcr As Range
Dim i As Integer, adres As String
Sheets("Arama").Select
If Range("A1") = "" Then MsgBox "A1 Hücresine Aranacak Değeri Girin'": Exit Sub
sat = 2: Range("A" & sat, "A" & Rows.Count).ClearContents
For i = 1 To Worksheets.Count
If Not Sheets(i).Name = "Arama" Then
With Sheets(i).Cells
Set sonhcr = .Cells(.Rows.Count)
Set c = .Find(Range("A1"), sonhcr, xlValues, xlWhole)
If Not c Is Nothing Then
Adr = c.Address
Do
adres = Sheets(i).Name & "!" & c.Address
ActiveSheet.Cells(sat, "A").Value = Cells(1, 1).Value
sat = sat + 1
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> Adr
End If
End With
End If
Next i
Set sonhcr = Nothing: Set c = Nothing
MsgBox "Listeleme Tamam!", , "Deneme"
End Sub
