Would like to hide certain cells

MiserableLawStdnt

New Member
Joined
Oct 4, 2011
Messages
3
Hello,

First of all I am a beginner Excel user. Now for the issue:

I am pulling some data from an access query. And just for background info this is financial info from an income statement database. The issue is, I am pulling a bunch of information which is blank for a lot of the fields. So for example I am pulling G&A info for all accounts. Well for a majority of the accounts G&A expense was zero.

The display format is TTM (trailing twelve months, basically the last 12 months from current date). So just for clarification the columns are periods of the last 12 months, and the rows are G&A for various accounts. Well at first I thought about hiding the rows if the entire row contained 0-values. Well the problem with that is thereis pertinent information once you get past the 12-month columns. So I can't hide the entire row.

I would like to hide the entire row only for that "table" which contains the G&A expense if they are zero. I hope this makes sense. So how can I collapse a select row of cells if they contain 0-value? Thank you.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
So I finally came up with this code after trying all day yesterday:

Sub Worksheet_Hide()
Dim lastRow As Long, myRange As Range
Application.Calculation = xlCalculationManual
lastRow = Cells(Rows.Count, 2).End(xlUp).Row
Rows.Hidden = False
For Each myRange In Range("g11:r62")
If myRange.Value = 0 Then myRange.EntireRow.Hidden = True
Next myRange
End Sub

Here is my problem. The range of the table that I need to check is g11:r62. If any cell in that range is populated then I don't want the row collapsed, but if every cell in the row is zero, then I would like it to be collapsed. As you can see now from looking at the code, it collapses everything. Every cell is hidden if any cell is empty.

Help please. I have too much work to do and can't spend an entire day on this.
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,750
Members
452,940
Latest member
rootytrip

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