Need to display only portion of LIST selection

beansinCA

New Member
Joined
May 14, 2004
Messages
19
Using Data-Validation I have setup a list at D1 using source =$M$1:$M$4

The source data is: M1="100 Customer 1", M2="101 Customer 2", M3="102 Customer 3", M4="103 Customer 4"

When a user selects an item from the list I just want to display the left three characters of the string (i.e. 100 if first selection is made). Is this doable in Excel?
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Hi beansinCA

In that case I believe you have to use the Change Event of the worksheet and extract the first 3 characters of the value.

Hope this helps
PGC
 
Upvote 0
Hi PGC,
I'm not sure what you mean by use Change Event. Can you provide a little more detail?

Thanks!
 
Upvote 0
Hi again

Paste this code in the module sheet (right-click on the sheet tab, choose view code, check that the highlighted module is the module of the sheet where D1 is, and paste this code).

Hope this helps
PGC

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$D$1" Then _
        Target.Value = Left(Target.Value, 3)
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,567
Messages
6,114,342
Members
448,570
Latest member
rik81h

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