ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Set Validation list to show top item (https://www.excelbanter.com/excel-programming/302748-set-validation-list-show-top-item.html)

tod

Set Validation list to show top item
 
I have a Data Validation List. Users can choose an item
from the list and have it show the value they have chosen.
I'm trying to write code that will reset the values on the
worksheet. For the validation list I'd like for it to
reset the cell to show the top item in the list.

For example, if the list is:

Select One
Dog
Cat
Rat
Snake

The user has chosen 'Rat' for the value. I want my code to
reset the cell to show 'Select One' as the value.

tod

Bob Phillips[_6_]

Set Validation list to show top item
 
Range("C1").Value ="Dog"

assuming that the DV is in C1. The cell is just a cell, so you can
overwrite the value

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Tod" wrote in message
...
I have a Data Validation List. Users can choose an item
from the list and have it show the value they have chosen.
I'm trying to write code that will reset the values on the
worksheet. For the validation list I'd like for it to
reset the cell to show the top item in the list.

For example, if the list is:

Select One
Dog
Cat
Rat
Snake

The user has chosen 'Rat' for the value. I want my code to
reset the cell to show 'Select One' as the value.

tod




Anders Silven

Set Validation list to show top item
 
One way,

If you name the validation list, for example ValList, you can do
range("M17").Value = range("ValList").Cells(1)
where M17 is the input cell with Data Validation (and validation is =ValList).

HTH
Anders Silven

"Tod" skrev i meddelandet
...
I have a Data Validation List. Users can choose an item
from the list and have it show the value they have chosen.
I'm trying to write code that will reset the values on the
worksheet. For the validation list I'd like for it to
reset the cell to show the top item in the list.

For example, if the list is:

Select One
Dog
Cat
Rat
Snake

The user has chosen 'Rat' for the value. I want my code to
reset the cell to show 'Select One' as the value.

tod



tod

Set Validation list to show top item
 
That worked for me. Thanx.

-----Original Message-----
One way,

If you name the validation list, for example ValList, you

can do
range("M17").Value = range("ValList").Cells(1)
where M17 is the input cell with Data Validation (and

validation is =ValList).

HTH
Anders Silven

"Tod" skrev i meddelandet
...
I have a Data Validation List. Users can choose an item
from the list and have it show the value they have

chosen.
I'm trying to write code that will reset the values on

the
worksheet. For the validation list I'd like for it to
reset the cell to show the top item in the list.

For example, if the list is:

Select One
Dog
Cat
Rat
Snake

The user has chosen 'Rat' for the value. I want my code

to
reset the cell to show 'Select One' as the value.

tod


.



All times are GMT +1. The time now is 08:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com