Skip to main content

AccessTr.neT


Vlookup İle Hücre Grubunu Sonuç Olarak Döndürme

Vlookup İle Hücre Grubunu Sonuç Olarak Döndürme

#28
kodun son en son hali)
Sub FormatliAra(ByVal txtAranan As String)
Dim RngAra As Range
Dim RngSonuc As Range
Dim RngBul As Range
Dim RngBul2 As Range
Dim Cll As Range
Dim Sht As Worksheet
Dim Sht2 As Worksheet

Set Sht = ThisWorkbook.Worksheets("Arama")
Set Sht2 = ThisWorkbook.Worksheets("IVL")
Set RngAra = Sht2.Range("A:A")

    ' Clear previous formats and set new format
    Application.FindFormat.Clear
    Application.FindFormat.Font.Bold = True 'formatlı arama için gerekli kod
With Sht
    Set RngBul = RngAra.Find(txtAranan, SearchFormat:=True)
    SonStr = .Cells(.Rows.Count, "c").End(xlUp).Row
   
        .Range("C:Q").EntireColumn.Delete
        .Cells.RowHeight = 15

    If RngBul Is Nothing Then Exit Sub 'veri yoksa işlemi iptal etme
    Sh2SonStr = Sht2.Cells(Sht2.Rows.Count, "A").End(xlUp).Row
    Set RngAra = Sht2.Range("A" & RngBul.Row & ":A" & Sh2SonStr)
    Set RngBul2 = RngAra.Find("IVL No", SearchFormat:=True)
       
    If RngBul2 Is Nothing Then rngRow = Sh2SonStr Else rngRow = RngBul2.Row - 1
   
    Set RngSonuc = Sht2.Range("A" & RngBul.Row - 1 & ":O" & rngRow)
    RngSonuc.Copy
    .Range("C2").PasteSpecial xlPasteAll
    .Cells.EntireColumn.AutoFit
    SonStr = .Cells(.Rows.Count, "c").End(xlUp).Row
    .Range("A" & SonStr).RowHeight = Sht2.Range("A" & RngBul.Row + (SonStr - 3)).RowHeight
    x = SonStr
    y = CLng(Split(.UsedRange.Address, "$")(4))
    If y > x Then .Range("A" & SonStr + 1 & ":" & Split(.UsedRange.Address, ":")(1)).EntireRow.Delete
End With
    Application.FindFormat.Clear
    Application.CutCopyMode = False
   
End Sub

y = CLng(Split(Split(.UsedRange.Address, ":")(1), "$")(2)) bu kısmı biraz uzatmışım tek split de yeterliydi
y = CLng(Split(.UsedRange.Address, "$")(4))
.rar BulFormatlı_hy5.rar (Dosya Boyutu: 35,08 KB | İndirme Sayısı: 9)
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Bu Konudaki Yorumlar
Re: Vlookup İle Hücre Grubunu Sonuç Olarak Döndürme - Yazar: berduş - 06/05/2021, 16:01