Listbox1 'de herhangi bir satıra tıklandığında Listbox2'ye sadece hücre değeri gelsin.

Katılım
28 Ağustos 2009
Mesajlar
2
Excel Vers. ve Dili
2005
Arkadaşlar iyi çalışmalar.

Benim istediğim userform açıldıktan sonra listbox1'de A sütununun 5. sıtarına tıkladığımda sadece h5 hücresindeki değer gelsin istiyorum.
 

ÖmerFaruk

Destek Ekibi
Destek Ekibi
Katılım
22 Ekim 2017
Mesajlar
4,779
Excel Vers. ve Dili
Microsoft 365 Tr-64
C#:
Private Sub ListBox1_Click()
    ListBox2.Clear
    ListBox2.AddItem Range("H" & ListBox1.ListIndex + 1)
End Sub
 

muratboz06

Destek Ekibi
Destek Ekibi
Katılım
23 Mart 2017
Mesajlar
568
Excel Vers. ve Dili
Office365 TR
Deneyiniz.
Kod:
Private Sub ListBox1_Change()
    For i = 0 To ListBox1.ListCount - 1
        If ListBox1.Selected(i) = True Then
            ListBox2.Clear
            ListBox2.AddItem Cells(i + 1, 8).Value
        End If
    Next i
End Sub
 
Katılım
28 Ağustos 2009
Mesajlar
2
Excel Vers. ve Dili
2005
Her iki kodda mükemmel çalışmakta. Yine başka bir sorunum çıktı ortaya şu kodlardan sonra userform açıldıktan sonra webrowser üzerinden pdf önizlemesi yapabiliyorum.
Kod:
Me.WebBrowser1.Navigate ListBox1.Column(1)
Application.Wait (Now + TimeValue("0:00:01"))
Fakat arama yaptıktan sonra listboxtan seçince önizleme yaptırmıyor.
Arama kodları :
Kod:
Private Function Find_All(hcr As Long, srch As Long)

Dim k As Range, adrs As String, j As Byte, a As Long
ReDim myarr(1 To 50, 1 To 65536)
ReDim Veri(1 To 2)
Veri(1) = Array("C1:C65536", "E1:E65536", "F2:F65536", "B2:B65536")
Veri(2) = Array(TextBox1.Value, TextBox2.Value, TextBox3.Value, TextBox4.Value)
With Worksheets("Sayfa1")
    ListBox1.RowSource = ""
    
    If .FilterMode Then .ShowAllData
     Set k = .Range(Veri(1)(hcr)).Find("*" & UCase(Replace(Replace((Veri(2)(srch)), "ı", "I"), "i", "İ")) & "*", , xlValues, xlWhole)
    If Not k Is Nothing Then
        adrs = k.Address
        Do
            a = a + 1
            For j = 1 To 50
            myarr(j, a) = .Cells(k.Row, j).Value
            Next j
            Set k = .Range(Veri(1)(hcr)).FindNext(k)
        Loop While Not k Is Nothing And k.Address <> adrs
        ReDim Preserve myarr(1 To 50, 1 To a)
        
        
        
        ListBox1.Column = myarr
        ListBox1.ColumnCount = 8
        ListBox1.ColumnWidths = "1;75;55;65;75;275;50;0"
        
        
        
      
        
        
        
        
    End If
End With
End Function
 
Üst