私は現在このコードを持っています:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim lastrow As Long
Dim rngList As Range
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set rngList = Range("AB3").CurrentRegion
If Target.Cells.Count > 1 Then Exit Sub
On Error Resume Next
If Not Intersect(Target, Range("B18:B19")) Is Nothing Then ' user is in column-A
Target.Value = Application.WorksheetFunction.VLookup(Target.Value, rngList, 2, False)
End If
Set rngList = Nothing
End Sub
と
Private Sub Worksheet_Change(ByVal Target As Range)
Dim lastrow As Long
Dim rngList As Range
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set rngList = Range("AC3").CurrentRegion
If Target.Cells.Count > 1 Then Exit Sub
On Error Resume Next
If Not Intersect(Target, Range("B10:B11")) Is Nothing Then ' user is in column-A
Target.Value = Application.WorksheetFunction.VLookup(Target.Value, rngList, 2, False)
End If
Set rngList = Nothing
サブ終了
両方を使えるように組み合わせたいのですが、どうすれば競合せずに使えるのかわかりませんので、よろしくお願いします。