PDA

View Full Version : [SOLVED] Userform search is not working after delete any record



elsuji
09-30-2020, 10:49 AM
​Dear Team,


I had created the userform for Add, Update, Delete the customer details. And I am having listbox for search the customers.


In this once I entered any value on Combobox2( for search customer name), the listbox will update ​automatically by filtering the data in sheet "Customer data" by partially matching​​ the value typed in Combobox2 and It is working for all the function properly.


But when I am delete any customer through the userform, after that the autofilter partially not working. When the whole value is matching then only the listbox is updating.


And I want to update the header for my listbox. The header range is Sheet"Customer Data" ("A2:H2").


I don't know where I am doing mistake.


I am attaching my file here for your reference.


Please help me to solve this issue

elsuji
10-02-2020, 01:18 PM
Dear Team,

Any one please reply to my query

elsuji
10-05-2020, 12:26 PM
Dear Team,

I changed the delete button code to


Private Sub CommandButton5_Click()

'For delete the customers
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Customer Data")
Dim Selected_Row As Long
Selected_Row = Application.WorksheetFunction.Match(Me.customername.Value, sh.Range("B:B"), 0)
sh.Range("B" & Selected_Row).EntireRow.Delete


Dim sh1 As Worksheet
Set sh1 = ThisWorkbook.Sheets("Master data")
Dim Selected_Row1 As Long
Selected_Row1 = Application.WorksheetFunction.Match(Me.customername.Value, sh1.Range("B:B"), 0)
sh1.Range("B" & Selected_Row1).EntireRow.Delete


Call Clear
End Sub

Now my search button is working properly even if i delete any values.