ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   selection.value < "A list of values" (https://www.excelbanter.com/excel-programming/365712-selection-value-list-values.html)

[email protected]

selection.value < "A list of values"
 
I only want my code to execute if the value of the selected cell does
not equal any of the values in a defined list of values. Instead of
constructing an If . . . Then statement that repeats "selection.value
< value1 AND selection.value < value2 . . ." I'm hoping someone might
tip me off on a more efficient way of writing my If . . . Then
statement. I think it would be something like "If not selection.value
in (value1, value2 . . .) then", but trial and error is a little
frustrating. Thanks.


RB Smissaert

selection.value < "A list of values"
 
Look at the Match function in the help.

RBS

wrote in message
oups.com...
I only want my code to execute if the value of the selected cell does
not equal any of the values in a defined list of values. Instead of
constructing an If . . . Then statement that repeats "selection.value
< value1 AND selection.value < value2 . . ." I'm hoping someone might
tip me off on a more efficient way of writing my If . . . Then
statement. I think it would be something like "If not selection.value
in (value1, value2 . . .) then", but trial and error is a little
frustrating. Thanks.




All times are GMT +1. The time now is 12:31 AM.

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