abdo meghari
Well-known Member
- Joined
- Aug 3, 2021
- Messages
- 651
- Office Version
- 2019
Hi
I would adapt @DanteAmor's code
I would when I write item in txtbox1 then should merge amount in column G for duplicates item.
and change the date column A to auto srial 1,2,3 when merging. but when clear then will return the original data as the original code does it.
thanks
I would adapt @DanteAmor's code
VBA Code:
Option Explicit
Dim a As Variant
Private Sub TextBox1_Change()
Call FilterData
End Sub
Sub FilterData()
Dim txt1 As String, txt2 As String, txt3 As String
Dim i As Long, j As Long, k As Long
ListBox1.Clear
ReDim b(1 To UBound(a, 1), 1 To UBound(a, 2))
For i = 1 To UBound(a)
If TextBox1 = "" Then txt1 = a(i, 4) Else txt1 = TextBox1
Then
k = k + 1
For j = 1 To 7
b(k, j) = a(i, j)
Next
End If
Next
If k > 0 Then ListBox1.List = b
End Sub
Private Sub UserForm_Activate()
a = Sheets("purchase").Range("A2:G" & Sheets("purchase").Range("D" & Rows.Count).End(3).Row).Value
End Sub
and change the date column A to auto srial 1,2,3 when merging. but when clear then will return the original data as the original code does it.
thanks