Hiding rows, conditionally

Peter Muller

Board Regular
Joined
Oct 15, 2018
Messages
133
Office Version
  1. 365
Platform
  1. Windows
In column A, from row 7 to rows 500+ I have a list of clothing and accessories items, with a blank row separating each category.

In column J, from row 7 to 500+ I have the sum of sales figures, relating to the list in Col A.

I am looking for a macro that will hide the rows if the sum result in Col J is less than 1, or 0, but must not hide the separating rows as indicated in col A.

This list will change daily as stock is received or sold

Can you please help me with this.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Maybe something like this...

Code:
Sub Hide() LastRow = Cells(Rows.Count, 10).End(xlUp).Row '10 = Column J


For Each c In Range("J1:J" & LastRow)
  If c.Value < 1 And Not c.Offset(0, -9) = "" Then 'do if value in J is less then 1 and if column A is not blank
    Rows(c.Row).EntireRow.Hidden = True 'Hide the row
  End If
Next c


End Sub
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,525
Members
449,088
Latest member
RandomExceller01

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