Macro based on multiple conditions

Dhoffl

New Member
Joined
Jun 10, 2020
Messages
4
Office Version
  1. 2016
Platform
  1. Windows
I have a very limited understanding of macro and VBA

I am trying to make a hidden row appear only if the following conditions are met:

1. A specific option is selected from one drop down menu
2.Any of 4 options (mme, lc, isb or cre) are selected from another drop down list which contains multiple other options
2. At least two cells in a range of four cells are populated with "yes"

if not all criteria are met the row should remain hidden.

Any pointers on this would be great as I have been effectively teaching myself from YouTube and excel forums and have hit a wall on this one.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Assuming your first dropdown list is in cell A1 and you second dropdown list is in cell B1 and you range for the 'yes' critereis is C1:C4
VBA Code:
If Range("A1").Value = "Specific Option" Then
    If Range("B2").Value = "mme" Or Range("B2").Value = "lc" Or Range("B2").Value = "isb" Or Range("B2").Value = "cre" Then
       If Application.CountI(Range("C1:C4"), "yes") = 2 Then
           Rows(5).Hidden = True
       End If
    End If
End If
 
Upvote 0
Thank you for sharing that. I get an error saying application doesnt support that object or method. It highlighting the row Application.countI
 
Upvote 0
Thank you for sharing that. I get an error saying application doesnt support that object or method. It highlighting the row Application.countI
Oops Sorry, ignore me I realise I needed it to be count if. thank you so much for your help!
 
Upvote 0

Forum statistics

Threads
1,214,395
Messages
6,119,265
Members
448,881
Latest member
Faxgirl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top