回答編集履歴
1
コード追加
answer
CHANGED
@@ -35,4 +35,34 @@
|
|
35
35
|
Next
|
36
36
|
End With
|
37
37
|
End Sub
|
38
|
+
```
|
39
|
+
|
40
|
+
---
|
41
|
+
別案
|
42
|
+
|
43
|
+
```vba
|
44
|
+
Private Sub UserForm_Initialize()
|
45
|
+
With ListBox1
|
46
|
+
.ColumnCount = 4
|
47
|
+
.ColumnWidths = "20;100;0;0"
|
48
|
+
End With
|
49
|
+
|
50
|
+
With ListBox2
|
51
|
+
.ColumnCount = 2
|
52
|
+
.ColumnWidths = "50;50"
|
53
|
+
End With
|
54
|
+
|
55
|
+
With Worksheets("リスト1").Range("A1").CurrentRegion
|
56
|
+
ListBox1.List = .Offset(1).Resize(.Rows.Count - 1, 4).Value
|
57
|
+
ListBox1.ListIndex = 0
|
58
|
+
End With
|
59
|
+
End Sub
|
60
|
+
|
61
|
+
Private Sub ListBox1_Click()
|
62
|
+
With ListBox1
|
63
|
+
ListBox2.Clear
|
64
|
+
ListBox2.AddItem .List(.ListIndex, 2)
|
65
|
+
ListBox2.List(0, 1) = .List(.ListIndex, 3)
|
66
|
+
End With
|
67
|
+
End Sub
|
38
68
|
```
|