Active Member
October 6, 2021
Hello,
I found the below code that replaces the dropdown value with the second field of the "list" on the 6th coumn
However, I have another list for the 7th, 8th so on... column. Below code only works for 1 column in the worksheet. What code can I add to below code to make it work for multiple columns??
Thank you, in advance, for your help
Regards
Ahmet
-------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'Updateby Extendoffice
Dim xRg As Range
selectedNa = Target.Value
If Target.Column = 6 Then
Set xRg = ActiveWorkbook.Names("list1").RefersToRange
selectedNum = Application.VLookup(selectedNa, xRg, 2, False)
If Not IsError(selectedNum) Then
Target.Value = selectedNum
End If
End If
End Sub
--------------------------------------------------------------------
Trusted Members
February 13, 2021
Hi Ahmet!
Currently your target.column is set to column 6, you would need to set your target.column to the columns you need. Is it possible for you to upload a demo of your spreadsheet with what you're looking to accomplish so I can take a look at it? I have ideas but I don't know if they would work without seeing what you need.
Active Member
October 6, 2021
Hello Jes,
Thank you for your kind return and I apologize for my late reply.
As seen in the attached sheet I am replacing dropdown value with a code. However, I can only do it for 1 column
For example for gender when Man is chosen it returns 1. Please kindly help how I can replace dropdown values of marital status and customer status with relevant values given in the Lists tab
Thank you
1 Guest(s)