ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Validation (Drop down list vs simple text length validation) (https://www.excelbanter.com/excel-programming/296443-re-validation-drop-down-list-vs-simple-text-length-validation.html)

Bob Phillips[_6_]

Validation (Drop down list vs simple text length validation)
 
One has Data Validation applied to it, the other doesn't See
http://www.contextures.com/xlDataVal01.html

--

HTH

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

"Jac Tremblay" wrote in message
...
Hi everyone,
I want to know how to distinguish between a cell that displays a drop down

list in a cell and another that does not.

Thank you.




Dick Kusleika[_3_]

Validation (Drop down list vs simple text length validation)
 
Not necessarily.

Check the InCellDropdown property of the Validation object

Range("A1").Validation.InCellDropDown

will be True or False.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Bob Phillips" wrote in message
...
One has Data Validation applied to it, the other doesn't See
http://www.contextures.com/xlDataVal01.html

--

HTH

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

"Jac Tremblay" wrote in message
...
Hi everyone,
I want to know how to distinguish between a cell that displays a drop

down
list in a cell and another that does not.

Thank you.






Dick Kusleika[_3_]

Validation (Drop down list vs simple text length validation)
 
Jac

That's true. You can have List Validation and not have a dropdown, so the
right answer is a combination of the two

If .Type = xlValidateList and .InCellDropdown Then


--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com


"Jac Tremblay" wrote in message
...
Hi Dick,
The .InCellDropDown property always returns TRUE, no matter if the cell

displays a drop down list or not (there must be a validation though).
' *****
Sub TestList2()
With ActiveCell.Validation
If .InCellDropdown = True Then
MsgBox "It's a drop-down list!"
Else
MsgBox "It's not a drop-down list!"
End If
End With
End Sub
' *****
This code does the job:
' *****
Sub TestList()
With ActiveCell.Validation
If .Type = xlValidateList Then
MsgBox "It's a drop-down list!"
Else
MsgBox "It's not a drop-down list!"
End If
End With
End Sub
' *****
Thanks to Jason Morin and to all of you.





All times are GMT +1. The time now is 04:32 PM.

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