Dropdown list description different to value returned

tlc53

Active Member
Joined
Jul 26, 2018
Messages
399
Hi there,

I've been struggling with this for a while now. I have found a VBA code that's close to what I want but I do not know how to amend the code so the dropdown data is on a different sheet.

On my sheet named "O2" I have a dropdown list in cells F7:F99 which currently correctly shows the dropdown description I want but I need it to return the code/value to the left of the description (0, 1, 8 & 9)
My dropdown list is located at the top left of "Sheet2" and is named "GST_Codes". It looks like this;

[TABLE="width: 200"]
<tbody>[TR]
[TD]Code[/TD]
[TD]Description[/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]0 - STD[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1 - Claimable[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]8 - Exempt[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]9 - N/A[/TD]
[/TR]
</tbody>[/TABLE]

My poorly attempted VBA Code currently looks like this;

Private Sub Worksheet_Change(ByVal Target As Range)
'Updateby Extendoffice 20161026
selectedNa = Target.Value
If Target.Column = 5 Then
selectedNum = Application.VLookup(selectedNa, Sheet2.Range("GST_Codes"), 2, False)
If Not IsError(selectedNum) Then
Target.Value = selectedNum
End If
End If
End Sub

I would also like the user to be able to manually enter 0, 1, 8 & 9 (ie. without selecting from the dropdown list)

Hoping a smart cookie can help me please. Thank you!!
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top