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
 

dEdE

Destek Ekibi
Destek Ekibi
Katılım
1 Temmuz 2005
Mesajlar
2,605
Excel Vers. ve Dili
Ofis 2013 TR 64 Bit
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.....)
 
Katılım
27 Şubat 2024
Mesajlar
4
Excel Vers. ve Dili
office 2013 - türkçe
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)
 

cems

Altın Üye
Katılım
2 Eylül 2005
Mesajlar
2,483
Excel Vers. ve Dili
office 2010 tr 32bit
Altın Üyelik Bitiş Tarihi
13-06-2029
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.
 
Katılım
27 Şubat 2024
Mesajlar
4
Excel Vers. ve Dili
office 2013 - türkçe
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
 

cems

Altın Üye
Katılım
2 Eylül 2005
Mesajlar
2,483
Excel Vers. ve Dili
office 2010 tr 32bit
Altın Üyelik Bitiş Tarihi
13-06-2029
kolay gelsin
 
Üst