hi
I need show date format in first column in list box as in column A in sheet like this yyyy/mm/dd and show format number in columns 5,6,7 in listbox as in columns E,F,G like this #,##0.00
here is my codes
I need show date format in first column in list box as in column A in sheet like this yyyy/mm/dd and show format number in columns 5,6,7 in listbox as in columns E,F,G like this #,##0.00
here is my codes
VBA Code:
Private Sub OptionButton3_Click()
If OptionButton3.Value = True And OptionButton4.Value = False Then
Label30.Caption = "cus"
End If
Dim a As Variant
Dim i As Long
Dim sheetname As String
For i = 3 To 4
With Me.Controls("OptionButton" & i)
If .Value Then sheetname = .Caption: Exit For
End With
Next
ListBox1.ColumnWidths = "95;100;80;90;100;100;80" 'Column Widths Of Listbox
ListBox1.ColumnCount = 7 'Column Count Of Listbox
a = Sheets(sheetname).Range("A2:G" & Sheets(sheetname).Cells(Rows.Count, 1).End(xlUp).Row).Value
For i = LBound(a, 1) + 1 To UBound(a, 1)
Next i
ListBox1.List = a
End Sub
Private Sub OptionButton4_Click()
If OptionButton4.Value = True And OptionButton3.Value = False Then
Label30.Caption = "pay"
End If
Dim a As Variant
Dim i As Long
Dim sheetname As String
For i = 3 To 4
With Me.Controls("OptionButton" & i)
If .Value Then sheetname = .Caption: Exit For
End With
Next i
ListBox1.ColumnWidths = "95;100;80;90;100;100;80" 'Column Widths Of Listbox
ListBox1.ColumnCount = 7 'Column Count Of Listbox
a = Sheets(sheetname).Range("A2:G" & Sheets(sheetname).Cells(Rows.Count, 1).End(xlUp).Row).Value
For i = LBound(a, 1) + 1 To UBound(a, 1)
Next i
ListBox1.List = a
End Sub
Private Sub TextBox9_Change()
Dim a As Variant, b As Variant
Dim i As Long, j As Long, k As Long
Dim cad As String, bExists As Boolean
Dim sheetname As String
For i = 3 To 4
With Me.Controls("OptionButton" & i)
If .Value Then sheetname = .Caption: Exit For
End With
Next i
a = Sheets(sheetname).Range("A2:g" & Sheets(sheetname).Cells(Rows.Count, 1).End(3).Row).Value
ReDim b(1 To UBound(a, 1), 1 To UBound(a, 2))
For i = 1 To UBound(a, 1)
bExists = False
For j = 1 To UBound(a, 2)
If InStr(1, a(i, j), TextBox9.Value, vbTextCompare) > 0 Then
bExists = True
Exit For
End If
Next j
If bExists Then
k = k + 1
For j = 1 To UBound(a, 2)
b(k, j) = a(i, j)
Next j
End If
Next i
ListBox1.List = b
End Sub