Using ListBox in Userform is very common. You can use ListBox.AddItem function to add items in the listbox.; however, it is little difficult to add items in Listbox when the number of columns are more than one.
'Event handler to add list item in ListBox
Private Sub cmdSubmit_Click()
'Add an item in the listbox
lstDepartment.AddItem "Item Name"
'If listbox has more than one column then add column value
'Column 1
lstDepartment.Column(1, lstDepartment.ListCount - 1) = "Item " & lstDepartment.ListCount
'Column 2
lstDepartment.Column(2, lstDepartment.ListCount - 1) = "Item " & lstDepartment.ListCount
End Sub
VBA Code to Browse a Folder Quite often a VBA developer requires code to browse a folder. This is mainly for saving the output file or reading the input file(s). Below is the VBA code…
How to Find Duplicate Files In excel using VBA? Yesterday I was working on my computer and cleaning the drives to make some more space. I was surprised to see so many files saved at…
Introduction :- ColorIndex in Excel VBA Today let’s try to understand how ColorIndex property in Excel VBA works. It is an easy and effective way to quickly complete the development. ColorIndex property is normally used…
This Excel VBA Code converts the excel range into HTML and also can convert Excel to HTML Table to paste data on Outlook Email Body
VBA Code To Delete All Shapes On A Excel sheet Here is a VBA code which deletes all the shapes from an Excel sheet. Code is simple but you have to be bit careful while…
Free File Renamer Tool – Quickly Rename files batch using Excel VBA Here is another help code and tool for programmers to rename files. You can use this tool for renaming all files available in…