Only adding last characters from a Data Validation list

rsrts

New Member
Joined
Jan 20, 2010
Messages
10
Hi Guys!

I have just added the data validation-function (list) in a cell linked to another sheet. Lets say I have values such as "1234 Horse", "2345 Cow", "3456 Pig" and so on...

Is it it possible to automatically "cut off" the characters following the four digits after it is selected into the cell, while still retaining the whole value in the actual drop down-list? That is, instead of showing "1234 Horse" in a cell after selecting it, it only displays "1234".

//rsrts
 
Last edited:

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Hi and welcome to the board!!!
With code?? In the worksheet module (Right Click the sheet tab and choose "view Code"
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Address <> "$A$1" Then Exit Sub
Application.EnableEvents = False
Target = Left(Target, 4)
Application.EnableEvents = True
End Sub
Set for your dropdown in A1. Adjust as needed. You can also run on more than one dropdown. Post back your requirements!

lenze
 
Upvote 0
This is very promising, indeed! It gives me the result I am looking for. Thanks for the fast response!

But I guess the only solution to my problem is coding this macro? Then the users I distribute my file to will always get the popup asking them whether to activate macros or not before proceeding? Some colleagues with less computer experience might find it annoying.

I tried to get this macro code to range between cell B7-B20 (<> "$B7:$B20") but I couldn't get it too work. Is this wrong? I am very new to this.

Are there other similar or perhaps better ways to do a list like this without the data validation-function? I guess combo boxes are ruled out since I need to be able to easily copy the values over to another program.
 
Upvote 0

Forum statistics

Threads
1,215,477
Messages
6,125,031
Members
449,205
Latest member
Eggy66

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