2列のExcelスプレッドシートがあります。1 つの列は組織名です。次の列は、組織が 1 時間あたりに請求する金額です。ユーザーフォームを使用しており、リストボックスとラベルがあります。リストボックスは、列 1 にすべての値を表示します。
Private Sub UserForm_Initialize()
Dim lbtarget As MSForms.ListBox
Dim rngSource As Range
'Set reference to the range of data to be filled
Set rngSource = Worksheets("Sheet1").Range("A2:A125")
'Fill the listbox
Set lbtarget = Me.ListBox1
With lbtarget
'Determine number of columns
.ColumnCount = 1
'Set column widths
.ColumnWidths = "100"
'Insert the range of data supplied
.List = rngSource.Cells.Value
End With
End Sub
リストボックスで選択したアイテムにラベルを対応させたい。たとえば、資産管理 (セル A2) を選択した場合、ラベルに同じ行を表示し、次の列 $47.00 (セル B2) を表示する必要があります。どんな助けでも大歓迎です。良い週末を!