View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default how to display different content depends on some conditions?

Assume you are using option buttons from the forms toolbar and they are
linked to cell F1 of the sheet where the display will be made. Thus, if I
choose the food option button, F1 will display 1 and If i select the beverage
option button, F1 will display 2 (you can put one of the option buttons over
F1 to conceal it).

so option button Food is over F1 and Option button Beverage is in F2

assume the display will start in F4

in F4 put

=IF($F$1="","",IF($F$1=1,Detail!A1,IF($F$1=2,IF(RO W()11,"",Detail!C1),"")))
You could simplify it to
=if($F$1="","",if($F$1=1,Detail!A1,if(row()11,"", Detail!C1)))
but you might want to expand it later to include 3 or more choices.

Now select F4 and drag fill to G4
now select F4:G4 and drag fill down to F13:G13

--
Regards,
Tom Ogilvy





"sam" wrote:

Hi,

In one worksheet(detail), I define two ranges, Range("A1:B10") contains
food info, Range("C1:D8") contains beverage info.

And in main worksheet(order), if the customer ticks the food info box,
i want the food info I defined in worksheet(detail) displayed below the
tick box; if the customer ticks the beverage info box, i want the
beverage info I defined in worksheet(detail) displayed below the tick
box. I assumed that only one box can be chosen(either food or beverage
box).

I think I can use the IF clause to slove this problem. I know some
basic knowledge about IF clause, like IF(logic_test; true; False). I
know how to display some character in the field of ture. However, I
don,t know how to display the Range info Like Range("A1:B10") from
worksheet(detail). "if clause" can solve this problem? If you have some
relevant experience about this, could you give me some hints? Thank you
in advances!!!


Regards

Sam