Display the contents of Data Validation List in Text box

FryGirl

Well-known Member
Joined
Nov 11, 2008
Messages
1,252
Office Version
  1. 2016
Platform
  1. Windows
This might sound like a weird request, but is it possible to display the contents of a Data Validation List in a TextBox.

On a sheet I'll have a TextBox, TextBox1. In column T, I have a range T4:T10 which all have individual Data Validation Lists.

When the cursor placed on T4, can TextBox1 show the contents of the Data Validation list. The list might be something like, Red, Black, Blue, and Green.

Of course, I know the user can click the drop down arrow of the Data Validation in that cell and see the contents, just curios if this selection can be shown in a TextBox.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

JackDanIce

Well-known Member
Joined
Feb 3, 2010
Messages
9,890
Office Version
  1. 365
Platform
  1. Windows
This link may help:

I placed a validation list in I5 containing values "a, b, c, d" and ran the following, you could substitute s for your TextBox:

VBA Code:
Sub test()
Dim s As String
s = [I5].Validation.Formula1
End Sub
 
Solution

JackDanIce

Well-known Member
Joined
Feb 3, 2010
Messages
9,890
Office Version
  1. 365
Platform
  1. Windows
If it helped, glad it's helped! Thanks for the feedback :)
 

Forum statistics

Threads
1,141,818
Messages
5,708,769
Members
421,589
Latest member
b_gernert

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
Top