Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multiple IF 's
Hi,
I would like a macro to be selected based upon the value of a cell. so if H25 = 100 then run macro ID100 and if H25 = 120 then run macro ID120 etc. And incorperating an else: MSG "Sorry (not in list/error)" if the cell contains other argument. TIA, Hans |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multiple IF 's
Hi Hans
try something like the following sub foo() select case range("H25").value case 100 ID100 case 120 ID120 case else msgbox "Sorry, not in list" end select end sub -- Regards Frank Kabel Frankfurt, Germany Hans Weustink wrote: Hi, I would like a macro to be selected based upon the value of a cell. so if H25 = 100 then run macro ID100 and if H25 = 120 then run macro ID120 etc. And incorperating an else: MSG "Sorry (not in list/error)" if the cell contains other argument. TIA, Hans |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multiple IF 's
Frank,
Vielen Dank! Das geht ja super. Mit Fr. Gr. Hans -----Original Message----- Hi Hans try something like the following sub foo() select case range("H25").value case 100 ID100 case 120 ID120 case else msgbox "Sorry, not in list" end select end sub -- Regards Frank Kabel Frankfurt, Germany Hans Weustink wrote: Hi, I would like a macro to be selected based upon the value of a cell. so if H25 = 100 then run macro ID100 and if H25 = 120 then run macro ID120 etc. And incorperating an else: MSG "Sorry (not in list/error)" if the cell contains other argument. TIA, Hans . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multiple IF 's
Hi Frank,
Would this work the same way for a text value? If H25 contained a list of product names and you wanted run different code based on which of those names was chosen, would you have to do anything differently since it's a non-numeric value? TIA, Mark ----- Frank Kabel wrote: ----- Hi Hans try something like the following sub foo() select case range("H25").value case 100 ID100 case 120 ID120 case else msgbox "Sorry, not in list" end select end sub -- Regards Frank Kabel Frankfurt, Germany Hans Weustink wrote: Hi, I would like a macro to be selected based upon the value of a cell. -- snip -- |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multiple IF 's
Hi
try something like select case range("H25").value case 100 ID100 case 120 ID120 case "textvalue1" IDText1 case "textvalue2" IDText2 case else msgbox "Sorry, not in list" end select end sub -- Regards Frank Kabel Frankfurt, Germany Mark Scureman wrote: Hi Frank, Would this work the same way for a text value? If H25 contained a list of product names and you wanted run different code based on which of those names was chosen, would you have to do anything differently since it's a non-numeric value? TIA, Mark ----- Frank Kabel wrote: ----- Hi Hans try something like the following sub foo() select case range("H25").value case 100 ID100 case 120 ID120 case else msgbox "Sorry, not in list" end select end sub -- Regards Frank Kabel Frankfurt, Germany Hans Weustink wrote: Hi, I would like a macro to be selected based upon the value of a cell. -- snip -- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
SUMPRODUCT, SUMIF, COUNTIF for multiple sheets for multiple criter | Excel Worksheet Functions | |||
Transposing Multiple Cell References to Multiple Values (NOT total | Excel Discussion (Misc queries) | |||
Delete Blank Rows Code - Multiple Worksheets - Multiple Documents | Excel Discussion (Misc queries) | |||
Display multiple lines of text within a cell from multiple column. | Excel Worksheet Functions | |||
view multiple files in multiple windows on multiple screens. | Excel Discussion (Misc queries) |