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 to Read Excel Data Using Connection String Sometimes as a programmer you need to read heavy (more then 5 MB) Excel files. There are two ways you can read data from Excel files: Open…
Table of Content VBA Code to Get User Domain Name VBA Code to Get User Domain Name – Method 1 VBA Code to Get User Domain Name – Method 2 Steps to use this VBA…
Random Rows Selector is an MS Excel based tool which can be used to pick random or stratified samples from a set of records available in the Excel. The tool is fully dynamic, it can support any data format in Excel.
Custom Calendar Control for MS Access MS Access by default provides inbuilt functionality to pick dates using calendar control; however it lacks few basic functionalities which makes selecting a date bit difficult. For example, if…
Merge Excel Files From last few months, we have been receiving frequent requests from users for a VBA tool which can consolidate Excel files from a folder. So here we come with one more free…
This Excel VBA Code helps to Get User Name. Here is an example environ(username) or Application.username.This macro gets the username from active directory.