Hiding Rows While Maintaining Page Layout

kkobmann

New Member
Joined
Aug 6, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I've attempted to search this forum for a like topic, but unfortunately my Excel terminology isn't great. So, it makes it a little tough.

I have a worksheet that has company names in column B. Columns C, D, E, F, and G all have data that doesn't have any baring on what I need to do. So, there are rows between the company names. In those row under the company name is either individual invoice information or it's blank. Columns H has the data that the equation or filter will be based on. Column I has the $ that will need to be summed up after the equation is finished.

What I'm trying to accomplish is:
1. To hide any row that is: less than or equal to 10 in Column H. Or said differently: To keep any row that is: greater or equal to 11 or is blank.

2. That the company names stay in the same relationship to the individual invoices.

The manual way that would give me what I'm looking to do, is to right click and hide any row that has a number that is 10 or less, which would keep everything in relationships, like it is now. Thanks in advance.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Screenshot or copy pasta would help picture what you're trying to explain.
I threw this together assuming it's what you meant. Starts assuming there's a header row.
Hides where values of H are under 10. To retain name, I made it not to hide if C through G are blank.

1691361144746.png


1691361169585.png



VBA Code:
Sub hideunder10()
    Dim lastRow As Long
    Dim ws As Worksheet
    Dim rng As Range
    Dim i As Long
    
 
    Set ws = ThisWorkbook.Sheets("Sheet1")

    lastRow = ws.Cells(ws.Rows.Count, "H").End(xlUp).Row
    
  
    For i = lastRow To 2 Step -1
        
        If ws.Cells(i, "H").Value <= 10 Then
          
            If Application.WorksheetFunction.CountA(ws.Range("C" & i & ":F" & i)) = 0 Then
               
            Else
               
                ws.Rows(i).EntireRow.Hidden = True
            End If
        End If
    Next i
End Sub
 
Upvote 0
noveske,

Here is an example of what I want to do. I tried doing the mini-sheet, but I had issues. Lol
 

Attachments

  • example.png
    example.png
    26.6 KB · Views: 7
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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