All,
I am new to this forum.
I have a script for data entry with two buttons new entry and change entry.
For the last one, i am looking to create a automatic filter based on a combobox.
The data is based in one worksheet, so when you want to change data you can select the transaction in the Listbox. But in there i want the filter that is generated by the Combobox.
This is the Command for changing data
Code
Private Sub CMB_change_Click()
Set wsAE = Worksheets("ADD-EXTEND")
Set Rng = wsAE.Range("A2:A" & wsAE.Cells(Rows.Count, "A").End(xlUp).Row)
Set fnd = Rng.Find(What:=C_02.Value, LookIn:=xlValues, Lookat:=xlWhole)
If LB_01.ListIndex = -1 Then
MsgBox "First choose a item in the list!", vbCritical, "Attention!"
Exit Sub
Else
If T_id = vbNullString Then
MsgBox "Customizing is not possible, no entries found", vbExclamation, "Attention!"
Exit Sub
ElseIf Not fnd Is Nothing Then
Application.EnableEvents = True
If MsgBox("Correct entry?", vbYesNo + vbQuestion, "Check the data!") = vbNo Then Exit Sub
wsAE.Cells(iRow, 1).Resize(, 13).Value = Array(T_id.Value, C_02.Value, T_02.Value, _
T_01.Value, T_18.Value, T_21.Value, T_22.Value, T_12.Value, C_05.Value, t_09.Value, , T_04.Value, T_03.Value)
'Columns.AutoFit
MsgBox "The changes have been saved.", vbInformation, "Done"
Application.EnableEvents = True
End If
For Each Ctrl In Controls
If TypeName(Ctrl) = "TextBox" Or TypeName(Ctrl) = "ComboBox" Then Ctrl.Value = ""
Next Ctrl
LB_01.ListIndex = -1
LB_01.TopIndex = 0
Call UserForm_Initialize
End If
End Sub
Display More
In here is mentioned where the listbox data is coming from
Code
Private Sub LB_01_Click()
C_02.Value = LB_01.Column(1)
T_02.Value = LB_01.Column(2)
T_01.Value = LB_01.Column(3)
T_12.Value = LB_01.Column(7)
C_05.Value = LB_01.Column(8)
T_04.Value = LB_01.Column(9)
T_03.Value = LB_01.Column(10)
t_09.Value = LB_01.Column(11)
T_18.Value = LB_01.Column(4)
T_21.Value = LB_01.Column(5)
T_22.Value = LB_01.Column(6)
End Sub
Private Sub UserForm_Initialize()
T_id.Value = WorksheetFunction.Max([ids]) + 1
LB_01.List = Sheets("ADD-EXTEND").Range("A:N").Value
C_02.List = [datalist].Value
C_05.List = [BUoM].Value
t_09.List = Sheets("SALDOFINALPIVOT").Range("A:B").Value
T_01.Value = Now
ThisWorkbook.RefreshAll
End Sub
Display More