Hide Colum+Row based on value of a cell

MrSoftee

New Member
Joined
Jun 15, 2015
Messages
2
Hi,

I was wondering if it's possible to hide a segment of rows and columns depending on the value of a cell. For example, if the value of a cell in the main sheet is "No" , then I need a segment of rows and columns in the second sheet to be hidden. If the value is "Yes" then that segment will become unhidden automatically. I'm pretty sure this is done with a vba code but so far I haven't found one. Any help would be greatly appreciated
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Welcome MrSoftee,

How do you know what rows and columns to hide? Is it a lookup? Can you provide concrete example?

Best,

Luke
 
Upvote 0
Thank you for your interest but I pretty much figured it out (so far). Basically the code I was interested in goes like this:

Private Sub Workbook_SheetActivate(ByVal Sh As Object)

If Sheets("Sheet1").Range("H38").Value = "Unknown: See RFI" Then
Sheets("Sheet2").Rows("20:21").EntireRow.Hidden = False

Else
Sheets("Sheet2").Rows("20:21").EntireRow.Hidden = True

End If


If Sheets("Sheet1").Range("H49").Value = "Unknown: See RFI" Then
Sheets("Sheet2").Rows("23:25").EntireRow.Hidden = False

Else
Sheets("Sheet2").Rows("23:25").EntireRow.Hidden = True

End If
End Sub

So if the value of a cell in the first sheet is "Unknown: See RFI" then the rows specified (in the second sheet) would automatically appear. Otherwise (for any other value) they would remain hidden. This way only the necessary Request for Information (RFI) will be sent to the customer while omitting everything else
 
Upvote 0

Forum statistics

Threads
1,203,379
Messages
6,055,094
Members
444,761
Latest member
lneuberger

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