Ok pulling my hair out here-
trying to get the value from column B in sheet2, by selecting dropdown list from column A
I have a dropdown list in sheet1 column J taking values from sheet2 column A
I created a defined name for column A and column B in sheet2 "my_defined_name"
I added VBA code to sheet1:
Private Sub Dropdown_Change(ByVal Target As Range)
selectedVal = Target.Value
If Target.Column = 10 Then
selectedNum = Application.VLookup(selectedVal, Worksheets("Sheet2").Range("my_defined_name"), 2, False)
If Not IsError(selectedNum) Then
Target.Value = selectedNum
End If
End If
End Sub
trying to get the value from column B in sheet2, by selecting dropdown list from column A
I have a dropdown list in sheet1 column J taking values from sheet2 column A
I created a defined name for column A and column B in sheet2 "my_defined_name"
I added VBA code to sheet1:
Private Sub Dropdown_Change(ByVal Target As Range)
selectedVal = Target.Value
If Target.Column = 10 Then
selectedNum = Application.VLookup(selectedVal, Worksheets("Sheet2").Range("my_defined_name"), 2, False)
If Not IsError(selectedNum) Then
Target.Value = selectedNum
End If
End If
End Sub