- Katılım
- 19 Haziran 2007
- Mesajlar
- 418
- Excel Vers. ve Dili
- excel 2007
Merhaba arkadaşlar. Mause exit olayında eklediğim kodlar ListBoxımda hataya neden oluyor.
Maus ile arama için, TextBoxlarıma tıklıyorum, ListBox'ıma tıklama yaparken tüm veriler kayboluyor.
Acaba sorun nedir çözemedim?
Maus ile arama için, TextBoxlarıma tıklıyorum, ListBox'ıma tıklama yaparken tüm veriler kayboluyor.
Acaba sorun nedir çözemedim?
Kod:
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
If ListBox1.ListIndex < 0 Then Exit Sub
TextBox1.Text = ListBox1.Column(0)
TextBox1.Value = Format(TextBox1, "dd.mm.yyyy")
TextBox2.Text = ListBox1.Column(1)
TextBox3.Text = ListBox1.Column(2)
TextBox4.Text = ListBox1.Column(3)
ComboBox1.Text = ListBox1.Column(4)
ComboBox2.Text = ListBox1.Column(5)
TextBox5.Text = ListBox1.Column(6)
TextBox6.Text = ListBox1.Column(7)
TextBox7.Text = ListBox1.Column(8)
ComboBox3.Text = ListBox1.Column(9)
ComboBox4.Text = ListBox1.Column(10)
TextBox8.Text = ListBox1.Column(11)
ComboBox5.Text = ListBox1.Column(12)
ComboBox6.Text = ListBox1.Column(13)
ComboBox7.Text = ListBox1.Column(14)
ComboBox8.Text = ListBox1.Column(15)
ComboBox9.Text = ListBox1.Column(16)
ComboBox10.Text = ListBox1.Column(17)
ComboBox11.Text = ListBox1.Column(18)
TextBox9.Text = ListBox1.Column(19)
TextBox10.Text = ListBox1.Column(20)
TextBox10.Value = Format(TextBox10, "dd.mm.yyyy")
CommandButton1.Enabled = True 'False yaparsanız kaydet butonu pasif olur
CommandButton2.Enabled = True
CommandButton3.Enabled = True
End Sub
Private Sub TextBox13_Change() 'KİŞİ ARA
Dim k As Range, adrs As String, j As Byte, a As Long
ReDim myarr(1 To 50, 1 To 65536)
If TextBox13.Text = "" Then
ListBox1.RowSource = "satış!A1:U" & Sheets("satış").[a65536].End(xlUp).Row
Exit Sub
End If
With Worksheets("satış")
ListBox1.RowSource = ""
If .FilterMode Then .ShowAllData
Set k = .Range("C2:C65536").Find(TextBox13.Text & "*", , 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("C2:C65536").FindNext(k)
Loop While Not k Is Nothing And k.Address <> adrs
ReDim Preserve myarr(1 To 50, 1 To a)
ListBox1.Column = myarr
End If
End With
End Sub
Private Sub TextBox13_Enter()
TextBox13 = ""
End Sub
Private Sub TextBox13_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal y As Single)
TextBox13 = ""
End Sub
Private Sub TextBox13_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TextBox13.Text = "KİŞİ ARA"
End Sub
Private Sub TextBox14_Change() 'ŞEHİR ARA
Dim k As Range, adrs As String, j As Byte, a As Long
ReDim myarr(1 To 50, 1 To 65536)
If TextBox14.Text = "" Then
ListBox1.RowSource = "satış!A1:U" & Sheets("satış").[a65536].End(xlUp).Row
Exit Sub
End If
With Worksheets("satış")
ListBox1.RowSource = ""
If .FilterMode Then .ShowAllData
Set k = .Range("E2:E65536").Find(TextBox14.Text & "*", , 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("E2:F65536").FindNext(k)
Loop While Not k Is Nothing And k.Address <> adrs
ReDim Preserve myarr(1 To 50, 1 To a)
ListBox1.Column = myarr
End If
End With
End Sub
Private Sub TextBox14_Enter()
TextBox14 = ""
End Sub
Private Sub TextBox14_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal y As Single)
TextBox14 = ""
End Sub
Private Sub TextBox14_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TextBox14.Text = "ŞEHİR ARA"
End Sub
Private Sub TextBox15_Change() 'TELEFON ARA
Dim k As Range, adrs As String, j As Byte, a As Long
ReDim myarr(1 To 50, 1 To 65536)
If TextBox15.Text = "" Then
ListBox1.RowSource = "satış!A1:U" & Sheets("satış").[a65536].End(xlUp).Row
Exit Sub
End If
With Worksheets("satış")
ListBox1.RowSource = ""
If .FilterMode Then .ShowAllData
Set k = .Range("G2:G65536").Find(TextBox15.Text & "*", , 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("G2:G65536").FindNext(k)
Loop While Not k Is Nothing And k.Address <> adrs
ReDim Preserve myarr(1 To 50, 1 To a)
ListBox1.Column = myarr
End If
End With
End Sub
Private Sub TextBox15_Enter()
TextBox15 = ""
End Sub
Private Sub TextBox15_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal y As Single)
TextBox15 = ""
End Sub
Private Sub TextBox15_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TextBox15.Text = "TELEFON ARA"
End Sub