first time vba-er seeking hide/unhide help

sonyaeb

New Member
Joined
Jul 1, 2014
Messages
6
I'm creating a brief doc and I have most of the "if this, then thats" but one section won't unhide cells - ref. B26.
The code above and below is working (ref. B23 & B39) - I have tried the bulk code as shown below and separated, but neither seem to work. Ideally, I would prefer that the code was shortened but I don't know the commands. Thank you in advance to anyone who can help!!

If Range("B23").Value = "N" Then
Rows("24").EntireRow.Hidden = True
ElseIf Range("B23").Value = "Y | N" Then
Rows("24").EntireRow.Hidden = True
ElseIf Range("B23").Value = "Y" Then
Rows("24").EntireRow.Hidden = False
End If

If Range("B26").Value = "Choose" Then
Rows("27:38").EntireRow.Hidden = True
ElseIf Range("B26").Value = "PROD_ROW1_1UP_LFT" Then
Rows("29:38").EntireRow.Hidden = True
ElseIf Range("B26").Value = "PROD_ROW1_1UP_LFT" Then
Rows("27:28").EntireRow.Hidden = False
ElseIf Range("B26").Value = "PROD_ROW1_1UP_LFT_RATING" Then
Rows("29:38").EntireRow.Hidden = True
ElseIf Range("B26").Value = "PROD_ROW1_1UP_LFT_RATING" Then
Rows("27:28").EntireRow.Hidden = False
ElseIf Range("B26").Value = "PROD_ROW1_1UP_RT_RATING" Then
Rows("29:38").EntireRow.Hidden = True
ElseIf Range("B26").Value = "PROD_ROW1_1UP_RT_RATING" Then
Rows("27:28").EntireRow.Hidden = False
ElseIf Range("B26").Value = "PROD_ROW1_2UP" Then
Rows("27:28").EntireRow.Hidden = True
ElseIf Range("B26").Value = "PROD_ROW1_2UP" Then
Rows("33:38").EntireRow.Hidden = True
ElseIf Range("B26").Value = "PROD_ROW1_2UP" Then
Rows("29:32").EntireRow.Hidden = False
ElseIf Range("B26").Value = "PROD_ROW1_3UP" Then
Rows("27:32").EntireRow.Hidden = True
ElseIf Range("B26").Value = "PROD_ROW1_3UP" Then
Rows("33:38").EntireRow.Hidden = False
End If

If Range("B39").Value = "Choose" Then
Rows("40:51").EntireRow.Hidden = True
ElseIf Range("B39").Value = "0" Then
Rows("40:51").EntireRow.Hidden = True
ElseIf Range("B39").Value = "1" Then
Rows("40:45").EntireRow.Hidden = False
ElseIf Range("B39").Value = "1" Then
Rows("46:51").EntireRow.Hidden = True
ElseIf Range("B39").Value = "2" Then
Rows("40:51").EntireRow.Hidden = False
End If
 
That helped and I also updated the command that I added earlier to 25:51

rows("23:51").EntireRow.Hidden = false

Thank you again - you have been amazingly helpful!!!! - Sonya


</pre>
 
Upvote 0

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,215,948
Messages
6,127,871
Members
449,410
Latest member
adunn_23

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