Forum

How to display diff...
 
Notifications
Clear all

How to display different dropdown values with multiple columns in the same worksheet

4 Posts
2 Users
0 Reactions
50 Views
(@ayalcin)
Posts: 3
Active Member
Topic starter
 

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
--------------------------------------------------------------------

 
Posted : 06/10/2021 8:01 pm
(@jstewart)
Posts: 216
Estimable Member
 

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.

 
Posted : 07/10/2021 10:07 am
(@ayalcin)
Posts: 3
Active Member
Topic starter
 

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

 
Posted : 14/10/2021 7:16 pm
(@ayalcin)
Posts: 3
Active Member
Topic starter
 

Hello,

Will you be able to help me with my previous question?

Thank you

 
Posted : 19/10/2021 4:03 am
Share: