0
votes

I am creating a model in Excel using VBA. On one of my sheets there are 2 Comboboxes. The first Combobox has a dropdown menu to choose the model's drug of comparison ("Drug 1", "Drug 2", "Drug 3"). The second Combobox has a dropdown menu for time horizon ("1 Month", "2 Months", "3 Months").

I want to write a code that executes ONLY IF a certain combination is chosen (i.e. "Drug 2" AND "3 Months").

For example, if a user chooses "Drug 2" and "3 Months", then in the next sheet called "Outputs", go hide rows 5 through 10.

I can't find a way to compare the selections for 2 Comboboxes. How can I do this?

1

1 Answers

0
votes

How about:

if combobox1.value = "Drug 2" and combobox2.value = "3 Months" then

    'code here

end if