Macro based on drop down values to hide or unhide rows

jjt1973

New Member
Joined
Jun 8, 2011
Messages
32
Hello. below are two different macros I have tried to accomplish my task of hiding and unhiding rows based on values given in a drop down list. The macros work in hiding the rows when they are empty but not unhiding them/re-hiding them when the the drop down list reflects a value...

Here are the two different macros.. I hope somebody can help me...

Macro 1:

If [E2].Value = "" Then
Range("A3:I3").EntireRow.Hidden = True
End If
If [E2].Value = "NAS" Then
Range("A3:I3").EntireRow.Hidden = True
End If
If [E2].Value = "CARD" Then
Range("A3:I3").EntireRow.Hidden = True
End If
If [E2].Value = "RETAIL" Then
Range ("A3:I3").EntireRow.Hidden = False
End If
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
If [E2].Value = "" Then
Range("A4:I4").EntireRow.Hidden = True
End If
If [E2].Value = "RETAIL" Then
Range("A4:I4").EntireRow.Hidden = True
End If
If [E2].Value = "CARD" Then
Range("A4:I4").EntireRow.Hidden = True
End If
If [E2].Value = "NAS" Then
Range ("A2:L2").EntireRow.Hidden = False
End If
End Sub

Macro 2 in place of macro 1... Same Results..

Sub channel()
Range("A3:I3").EntireRow.Hidden = [E2].Value = ""
Range("A4:I4").EntireRow.Hidden = [E2].Value = ""
End Sub

Macro #2 takes out the IF statements but I need those based on the options in the drop down list.

**NOTE this program is based on Excel 03
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,224,587
Messages
6,179,738
Members
452,940
Latest member
Lawrenceiow

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