Most valuable professional
  • Hot Topics

Excel Hide rows based on output from formula

Hi I have searched many forums and can't seem to find my answer to this problem I am working a large quoting program and I need certain rows to automatically hide when I have a cell condition based on a number i.e. if P30=1 I want the row hidden and if P30=2 I want the rows to appear. The numbers can be changed to "true" or "false" if it would work better. Currently this formula works but only if I got to the P30 cell and click and hit enter - the cell out put is from a differnt sheet and I don't know if that the problem. I need this formual to run all of the time as I make changes to the first sheet and this data is on sheet 4 - this data has a Macro which copys the info and pastes this in Word I have also tried Autofill with no luck. There are about 10 other differnt rows I need to hide based on formual outputs - Ideas? Here is the current formula - only works if I go to the sheet and manauly type 1 or 2 and hit enter, does not work from a formula output Private Sub Worksheet_Change(ByVal target As Range) If Range("s30").Value = 1 Then Rows("34:35").Select Selection.EntireRow.Hidden = True Range("s30").Select ElseIf Range("s30").Value = 2 Then Rows("34:35").Select Selection.EntireRow.Hidden = False Range("s30").Select End If End Sub

This question generated 24 answers. To proceed to the answers, click here.

This thread is current as of October 30, 2013.

For more resources for Microsoft Excel:

This article includes the following tags:

  • Excel
  • Microsoft Excel