Private Sub UserForm_Initialize()
Dim rheadings As Range
Dim cl As Range
Set rheadings = Worksheets(9).Range("A4:AA4")
For Each cl In rheadings
Me.ListBox1.AddItem cl.Value
Next cl
End Sub
Public PartsDeptLBValue As String
Private Sub PartsDeptButton_Click()
Dim Msg As String
Dim i As Integer
'If ListBox1.ListIndex <> -1 Then
'MsgBox "Select something"
'Else
Msg = "You selected" & vbNewLine
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
Msg = Msg & ListBox1.List(i) & vbNewLine
End If
Next i
MsgBox Msg
ListBox1.Value = PartsDeptLBValue
Unload PartsDeptUserForm
End Sub
Sub GetPartsDept_UserForm_Value()
PartsDeptUserForm.Show
MsgBox PartsDeptLBValue
End Sub
TestBuySellTemplate.xlsm
ASKER
ASKER
ASKER
Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.
TRUSTED BY
Open in new window