I updated the userform that I did previously to run it in all version of Excel.
With this userform ;
- Data can be added
- Data can be deleted
- Data can be edited
- Data can be searched on the sheet
- Listbox can be filled and emptied with button.
- Listbox can be scrolled with the spin button.
Id numbers are generated automatically when new record is added to the worksheet and when record is removed.
The listbox is empty when the userform is opened.
The entered value in the searching box can be searched on the worksheet. listbox are filled with the found results .
The listbox column widths is automatically adjusted according to the widths of the sheet's column with Vba codes.
The Address Book (Userform's Listbox Contains 12 Column)
A follower of the blog wanted this example.
Maximum 10 columns can be added to the listbox with ListBox1.AddItem Method. To solve this problem, we have filled the listbox an array.
Do
m = m + 1
ReDim Preserve myarr(1 To 12, 1 To m)
For j = 1 To 12
myarr(j, m) = .Cells(k.Row, j + 1).Value
Next j
Set k = .Range("B2:B" & Cells(Rows.Count, "B").End(xlUp).Row).FindNext(k)
Loop While Not k Is Nothing And k.Address <> adrs
ListBox1.Column = myarr
......