• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

  • Forum yazılımı güncelenmiştir.

    Beklenmedik durumlar görürseniz lütfen yönetime iletin.

Lisboxtan sayfaya sayı formatında veri aktarımı yapamıyorum

Katılım
27 Şubat 2024
Mesajlar
4
Excel Vers. ve Dili
office 2013 - türkçe
Selamun aleyküm
Userform üzerindeki listboxtan excele sayı formatında veri aktarmam gerekiyor ancak sayıyı metin formatında atıyor haliyle düşeyara formülüm çalışmıyor. Yardımcı olursanız sevinirim.
teşekkürler
 
Merhaba,
Kullandığınız kodu bilsek net yanıt verebilirdik. Olsa olsa yöntemini kullanalım. :)
Muhtemelen "Range("B7")=ListBox1.ListIndex......" şeklinde veya benzeri bir kod kullanıyorsunuzdur. Koda aşağıdaki gibi bir ek(Val) yaparak deneyelim.
Range("B7")=Val(ListBox1.ListIndex.....)
 
4 kolonlu bir listbox, bunun 4. kolonundaki rakamı sayfaya çift tıkla aktarıyorum ancak metin formatında atıyor. sayı olarak atsa işim çözülecek.
İlginize teşekkür ederim.


Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
ActiveCell = ListBox1

End Sub

Private Sub TextBox1_Change()
ListBox1.Clear
For p = 2 To [P15000].End(3).Row
On Error Resume Next
x = WorksheetFunction.Search(TextBox1, Cells(p, 1) & Cells(p, 16) & Cells(p, 17) & Cells(p, 18), 1)
If Err.Number > 0 Then
Err.Number = 0
Else
ListBox1.AddItem Cells(p, 1)
ListBox1.List(ListBox1.ListCount - 1, 1) = Cells(p, 16)
ListBox1.List(ListBox1.ListCount - 1, 2) = Cells(p, 17)
ListBox1.List(ListBox1.ListCount - 1, 3) = Cells(p, 18)
 
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
ActiveCell.Value = ListBox1.Value
End Sub

Private Sub TextBox1_Change()
ListBox1.Clear
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("Sheet1") ' Hedef sayfanın adını buraya yazın
Dim p As Long
For p = 2 To ws.Cells(ws.Rows.Count, 1).End(xlUp).Row
If InStr(1, Cells(p, 1) & Cells(p, 16) & Cells(p, 17) & Cells(p, 18), TextBox1.Value, vbTextCompare) > 0 Then
ListBox1.AddItem ws.Cells(p, 1).Value
ListBox1.List(ListBox1.ListCount - 1, 1) = CDbl(ws.Cells(p, 16).Value)
ListBox1.List(ListBox1.ListCount - 1, 2) = CDbl(ws.Cells(p, 17).Value)
ListBox1.List(ListBox1.ListCount - 1, 3) = CDbl(ws.Cells(p, 18).Value)
End If
Next p
End Sub

Bu kod, kullanıcı formundaki List Box'a sayı değerlerini CDbl() işleviyle ekler, böylece Excel'e sayı olarak aktarılır.
 
4 kolonlu bir listbox, bunun 4. kolonundaki rakamı sayfaya çift tıkla aktarıyorum ancak metin formatında atıyor. sayı olarak atsa işim çözülecek.
İlginize teşekkür ederim.


Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
ActiveCell = ListBox1

End Sub

Private Sub TextBox1_Change()
ListBox1.Clear
For p = 2 To [P15000].End(3).Row
On Error Resume Next
x = WorksheetFunction.Search(TextBox1, Cells(p, 1) & Cells(p, 16) & Cells(p, 17) & Cells(p, 18), 1)
If Err.Number > 0 Then
Err.Number = 0
Else
ListBox1.AddItem Cells(p, 1)
ListBox1.List(ListBox1.ListCount - 1, 1) = Cells(p, 16)
ListBox1.List(ListBox1.ListCount - 1, 2) = Cells(p, 17)
ListBox1.List(ListBox1.ListCount - 1, 3) = Cells(p, 18)
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
ActiveCell.Value = ListBox1.Value
End Sub

Private Sub TextBox1_Change()
ListBox1.Clear
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("Sheet1") ' Hedef sayfanın adını buraya yazın
Dim p As Long
For p = 2 To ws.Cells(ws.Rows.Count, 1).End(xlUp).Row
If InStr(1, Cells(p, 1) & Cells(p, 16) & Cells(p, 17) & Cells(p, 18), TextBox1.Value, vbTextCompare) > 0 Then
ListBox1.AddItem ws.Cells(p, 1).Value
ListBox1.List(ListBox1.ListCount - 1, 1) = CDbl(ws.Cells(p, 16).Value)
ListBox1.List(ListBox1.ListCount - 1, 2) = CDbl(ws.Cells(p, 17).Value)
ListBox1.List(ListBox1.ListCount - 1, 3) = CDbl(ws.Cells(p, 18).Value)
End If
Next p
End Sub

Bu kod, kullanıcı formundaki List Box'a sayı değerlerini CDbl() işleviyle ekler, böylece Excel'e sayı olarak aktarılır.
çok teşekkür ediyorum
 
kolay gelsin
 
Geri
Üst