Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SUMPRODUCT, SUMIF, COUNTIF for multiple sheets for multiple criter Greg in CO[_2_] Excel Worksheet Functions 0 September 18th 08 05:51 PM
Transposing Multiple Cell References to Multiple Values (NOT total LinLin Excel Discussion (Misc queries) 7 November 11th 07 10:57 PM
Delete Blank Rows Code - Multiple Worksheets - Multiple Documents BenS Excel Discussion (Misc queries) 3 June 29th 07 12:20 AM
Display multiple lines of text within a cell from multiple column. Zeeshan Zaheer Excel Worksheet Functions 3 August 23rd 06 10:08 AM
view multiple files in multiple windows on multiple screens. tcom Excel Discussion (Misc queries) 7 September 15th 05 09:35 PM


All times are GMT +1. The time now is 07:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"