Kirana2014
Gebruiker
- Lid geworden
- 21 okt 2020
- Berichten
- 55
Goedeavond,
Wellicht heeft iemand van jullie een oplossing voor het volgende:
Ik heb deze code in VBA geschreven om een bedrag met decimale te tonen in listbox
van het zoekresultaat
voorbeeld :
van 1500 naar 1.500,00 (zie excel file)
van 10000,00 naar 10.000,00
ik waardeer alle hulp.
Wellicht heeft iemand van jullie een oplossing voor het volgende:
Ik heb deze code in VBA geschreven om een bedrag met decimale te tonen in listbox
van het zoekresultaat
voorbeeld :
van 1500 naar 1.500,00 (zie excel file)
van 10000,00 naar 10.000,00
ik waardeer alle hulp.
Code:
Private Sub CMD_Search_Click()
Dim sat, s As Long
Dim WYN1, WYN2 As String
If SEARCH_1.Value = "" Then
MsgBox "Please enter a value", vbExclamation
SEARCH_1.SetFocus
Exit Sub
End If
If ComboBox2.Value = "" Or ComboBox2.Value = "-" Then
MsgBox "Choose a filter field", vbExclamation
ComboBox2.SetFocus
Exit Sub
End If
With ListBox1
.Clear
.ColumnCount = 4
.ColumnWidths = "65;78;65;70"
End With
WYN2 = SEARCH_1.Value
Select Case ComboBox2.Value
Case "IDNumber"
For sat = 2 To Cells(1048576, "A").End(xlUp).Row
Set WYN1 = Cells(sat, "A")
If UCase(WYN1) Like "*" & UCase(WYN2) & "*" Then
ListBox1.AddItem
ListBox1.List(s, 0) = Cells(sat, "A")
ListBox1.List(s, 1) = Cells(sat, "B")
ListBox1.List(s, 2) = Cells(sat, "C")
ListBox1.List(s, 3) = Cells(sat, "D")
s = s + 1
End If: Next
Case "Name"
For sat = 2 To Cells(1048576, "B").End(xlUp).Row
Set WYN1 = Cells(sat, "B")
If UCase(WYN1) Like "*" & UCase(WYN2) & "*" Then
ListBox1.AddItem
ListBox1.List(s, 0) = Cells(sat, "A")
ListBox1.List(s, 1) = Cells(sat, "B")
ListBox1.List(s, 2) = Cells(sat, "C")
ListBox1.List(s, 3) = Cells(sat, "D")
s = s + 1
End If: Next
Case "Product Sale"
For sat = 2 To Cells(1048576, "C").End(xlUp).Row
Set WYN1 = Cells(sat, "C")
If UCase(WYN1) Like "*" & UCase(WYN2) & "*" Then
ListBox1.AddItem
ListBox1.List(s, 0) = Cells(sat, "A")
ListBox1.List(s, 1) = Cells(sat, "B")
ListBox1.List(s, 2) = Cells(sat, "C")
ListBox1.List(s, 3) = Cells(sat, "D")
s = s + 1
End If: Next
End Select
Label15.Caption = ListBox1.ListCount
If Label15 = 0 Then
MsgBox "Er zijn geen zoekgegevens gevonden!", vbExclamation
SEARCH_1.SetFocus
Exit Sub
End If
End Sub
Bijlagen
Laatst bewerkt: