Unhide Row based on conditions

  • I'm trying to hide and unhide rows based on the value of Column H. If H=1 hide, if H=2 unhide. H has a if formula so based on the value of B2 the value of H will change. the Hide function works but the unhide function does not. Below is my code and I have attached a sample worksheet as well.


  • You code might not be working because calculations were set to manual.

    Here's a way to run it using the change event.

  • This line

    Code
    LastRow = Cells(Cells.Rows.Count, "H").End(xlUp).Row

    Will find the last VISIBLE row, so if all rows with data have been hidden, lastrow will be 1 & hence your code doesn't work.

    Is there any column that will allways have data below any hidden rows?

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!