jslings
11-21-2019, 11:34 AM
Hello! I am trying to create a user form that makes a user select a name from a Listbox and two options from checkboxes and returns the average of "days" and "amount" for that name selected from the listbox . I'm new to VBA and having trouble setting up the code to do so. Does anyone have any pointers? My userform is attached below, any help is appreciated, and this is what i have so far for code.
Private Sub BtnCancel_Click()
MsgBox ("Report Cancelled")
Unload FrmCust
End Sub
Private Sub BtnOk_Click()
Dim customer As Range
'For Each customer In allcustomers
If ListBoxCustlist.ListIndex = -1 Then
MsgBox "No Item was selected"
Else
MsgBox ' customers name and how much they owe / how many days if selected
End If
End Sub
Private Sub UserForm_Initialize()
' Fill the listbox with each user's name
Dim cell As Range
'Load to ListBox
FrmCust.ListBoxCustlist.MultiSelect = fmMultiSelectSingle 'allows only one selection
For Each cell In Worksheets("Data").Range("A3:A283")
ListBoxCustlist.AddItem cell.Value
Next cell
End Sub
Private Sub BtnCancel_Click()
MsgBox ("Report Cancelled")
Unload FrmCust
End Sub
Private Sub BtnOk_Click()
Dim customer As Range
'For Each customer In allcustomers
If ListBoxCustlist.ListIndex = -1 Then
MsgBox "No Item was selected"
Else
MsgBox ' customers name and how much they owe / how many days if selected
End If
End Sub
Private Sub UserForm_Initialize()
' Fill the listbox with each user's name
Dim cell As Range
'Load to ListBox
FrmCust.ListBoxCustlist.MultiSelect = fmMultiSelectSingle 'allows only one selection
For Each cell In Worksheets("Data").Range("A3:A283")
ListBoxCustlist.AddItem cell.Value
Next cell
End Sub