
お疲れ様です。pipiでございます。
vbaで以下の.ListCountが、何の値(数値)を取得している
のか分からない状態です。Listbox内は、0行目から数えられるから0行目を取得しているのでしょうか?
Listbox内の行の数え方と、Excelの行の数え方が、なかなか
連動しません。。。
どなたかご教授願います。
VBA
1Private Sub UserForm_Initialize() 2 3 Worksheets("商品マスタ").Select 4 5With ListBox1 6 .Font.Size = 10 7 .ColumnCount = 7 8 .ColumnWidths = "50;100;80;80;100;30;70" 9 .TextAlign = fmTextAlignLeft 10 .Font.Name = "MS ゴシック" 11 12'リストボックスんい商品マスタシートの情報を反映させる 13'.ListCountは、Listの0行目のことでしょうか? 14 Dim i As Integer 15 Dim LastLow As Integer 16 LastLow = Range("A60000").End(xlUp).Row 17 For i = 2 To LastLow 18 .AddItem Cells(i, 1).Value 19'ここから完全に.ListCountにどの様な値がはいっているか 20'分からない状態です。。。 21 .List(.ListCount - 1, 1) = Cells(i, 2).Value 22 .List(.ListCount - 1, 2) = Cells(i, 3).Value 23 .List(.ListCount - 1, 3) = Cells(i, 4).Value 24 .List(.ListCount - 1, 4) = Cells(i, 5).Value 25 .List(.ListCount - 1, 5) = Cells(i, 6).Value 26 .List(.ListCount - 1, 6) = Cells(i, 7).Value 27 28 Next 29End With 30 31End Sub 32

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。