Auto hide rows until values are entered

Kagz01

New Member
Joined
Jul 23, 2018
Messages
12
I have everything set up so that my upc codes pull the data and only Unique codes and their frequency are recorded. Now i need to auto hide the rows between 9 and 23 if column a is blank. The tricky part is that there is a formula in the all of the cells for pulling data. until data is entered on another sheet all rows from 9 to 23 are blank so that it doesnt look stupid. So, I want to hide those rows so that if someone buys only two products i dont have 15 lines of empty data to print. Thanks in advance for any help you can give!

Is there a formula to adjust row height? If so i can use an if formula to reference a cell with the word yes or no and adjust the height accordingly. Thanks again!


EDIT: Or an if statement that coincides with the earlier part of the statement, If (value of the previous formula = "") then Hide the row, if not Unhide the row.
 
Last edited by a moderator:
Code:
Private Sub Worksheet_Calculate()    HideRows
End Sub




Sub HideRows()
    BeginRow = 9
    EndRow = 23
    ChkCol = 1
    
    For RowCnt = BeginRow To EndRow
        With Cells(RowCnt, ChkCol)
            .EntireRow.Hidden = CBool(Len(.Value) = 0)
        End With
    Next RowCnt
End Sub


Sub HideRows2()
BeginRow = 9
EndRow = 23
ChkCol = 1




For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value > 1 Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = False
End If
Next RowCnt
End Sub


Ok this did something. It unhid ALL rows in the range even when they were Blank. Any idea what i did wrong?
 
Last edited:
Upvote 0

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,224,827
Messages
6,181,197
Members
453,021
Latest member
pingpong7117

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