Hiding Rows in Table with 0 Value - Table moves based on rows added above

SAB114

New Member
Joined
May 15, 2020
Messages
3
Office Version
  1. 2013
Platform
  1. Windows
Hi Everyone, This is my first post here so I hope I am not asking for too much.

I am creating an invoice in excel for our contract emloyees to use when invoicing their expenses. There are 2 tables: one Invoice Table for the employees to add their individual expenses and select a specific category (Food, Transportation etc) for that expense, and one Expense Category Totals table that calculates the sum of each expense category.

For the second table I would like any rows to be hidden where expense category total (in column D or 4) would be 0. And of course if the user adds an expense in that category I need it to reapear if the value becomes more than 0.

The other factor is that the Invoice Table above where users are adding the expenses has an "Add Row" button. So for every row added to the Invoice Table, the Expense Category Totals table is moved down by 1 row. I was using column A as a hidden column to list the cell ranges of the Expense Category Totals table (starting row of table in cell A2, ending row of table in cell A3).

Here is what I had currently:

Sub HIDESUMROWS()
BeginRow = (Range("A2"))
EndRow = (Range("A3"))
ChkCol = 4

For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value > 0 Then
Cells(RowCnt, ChkCol).Select
On Error Resume Next
Cells(RowCnt, ChkCol).EntireRow.Hidden = False
End If
Next RowCnt
End Sub

Thank you for any help you can provide on this, I sincerely appreciate any feedback! If it helps to include the invoice or screen shot of it, please let me know.

Stacey
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Bumping. Any help or feedback is sincerley appreciated. Thanks!
 
Upvote 0

Forum statistics

Threads
1,213,565
Messages
6,114,337
Members
448,568
Latest member
Honeymonster123

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