Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code Not Recognizing Value in Drop-Down Menu
I'm using VBA to put a drop-down list in a cell, with the following items a
user can select from: 1,2,3,4,5,6,7,8,9,10,11+ In later code, when I try to reference the response for this cell by saying: If Target.Address = $C$1 Then If Target.Value = "1", Then unhide rows xx:xx If Target.Value = "2", Then unhide rows xx:xx If Target.Value = "3", Then unhide rows xx:xx .....it works fine. But when I get to If Target.Value = "11+" .....Excel does not recognize what to do. I need to keep the cell (C1) formatted as a number. Can someone advise how to fix this? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code Not Recognizing Value in Drop-Down Menu
Hello Paige, Try this trick. Use the VAL(<string) method to convert "11+" to a number. VAL will convert upto the first non numeric character. Except for things like scientific notation, exponents and sign prefixes. This should work with no problem If Val(Taget.Value) = 11 Then Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=478940 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code Not Recognizing Value in Drop-Down Menu
Leith, you are WONDERFUL...works like a charm! Thanks so much!
"Leith Ross" wrote: Hello Paige, Try this trick. Use the VAL(<string) method to convert "11+" to a number. VAL will convert upto the first non numeric character. Except for things like scientific notation, exponents and sign prefixes. This should work with no problem If Val(Taget.Value) = 11 Then Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=478940 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA code for drop down menu problem. | Excel Discussion (Misc queries) | |||
Drop dwn menu. Formula to count selection frm menu in anoth cell? | Excel Worksheet Functions | |||
recognizing double digit numbers in code | Excel Discussion (Misc queries) | |||
Data Validation - Code Not Recognizing Something | Excel Programming | |||
Recognizing something is being pasted in code. | Excel Programming |