質問編集履歴
1
コード内容の追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -21,7 +21,22 @@
|
|
21
21
|
[ドロップダウンリストを作成し、Excelで異なる値を表示するには?](https://ja.extendoffice.com/documents/excel/4130-excel-drop-down-list-show-different-value.html?comment_id=18581)
|
22
22
|
上記URLを参考に試してみましたが、動作しませんでした。
|
23
23
|
|
24
|
+
### コード内容
|
25
|
+
```
|
26
|
+
Private Sub Worksheet_Change(ByVal Target As Range)
|
27
|
+
'Updateby Extendoffice
|
28
|
+
selectedNa = Target.Value
|
29
|
+
If Target.Column = 5 Then
|
30
|
+
selectedNum = Application.VLookup(selectedNa, Sheets("仕入先情報").Range("dropdown"), 2, False)
|
31
|
+
If Not IsError(selectedNum) Then
|
32
|
+
Target.Value = selectedNum
|
33
|
+
End If
|
34
|
+
End If
|
35
|
+
End Sub
|
24
36
|
|
37
|
+
```
|
38
|
+
|
39
|
+
|
25
40
|
### 補足情報(FW/ツールのバージョンなど)
|
26
41
|
|
27
42
|
Excelバージョン2019を使用
|