Hide and unhide equations?

G

Guest

Am I am able to hide and unhide a row by using an equation in excel? Bascially I want to have a row hidden until a value in a specific cell is No. Then I want it to be unhidden

Thank you

Dan Young
 
B

Bernie Deitrick

Dan,

You would need to use the worksheet's calculate event: for row 1 based
on cell A1:

Private Sub Worksheet_Calculate()
If Range("A1").Value = "No" Then Range("A1").EntireRow.Hidden = False
End Sub

Change the first A1 to your cell with the value, and the second to any
cell in the row you want to unhide.

Copy this code, right click on your sheet tab, and select "View Code"
then paste the code in the window that appears.

HTH,
Bernie
MS Excel MVP

Dan Young said:
Am I am able to hide and unhide a row by using an equation in excel?
Bascially I want to have a row hidden until a value in a specific cell
is No. Then I want it to be unhidden.
 
G

Guest

Bernie,
I just need one more thing. I am working with sperate sheets in a workbook. How do I do the code for a different sheet?

Thank you,

Dan
 
B

Bernie Deitrick

Dan,

Put this code into the codemodule of the "ThisWorkbook" object:

Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
If Worksheets("Sheet1").Range("A1").Value = "No" Then _
Worksheets("Sheet2").Range("A1").EntireRow.Hidden = False
End Sub

Change the sheet and range names as appropriate.

HTH,
Bernie
MS Excel MVP

Dan Young said:
Bernie,
I just need one more thing. I am working with sperate sheets in a
workbook. How do I do the code for a different sheet?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top