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;

CodeDescription
00 - STD
11 - Claimable
88 - Exempt
99 - N/A

<tbody>
</tbody>

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

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,214,918
Messages
6,122,257
Members
449,075
Latest member
staticfluids

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