Hide row depending on content of cell.

dredd_se

New Member
Joined
May 26, 2013
Messages
3
Hello dear excel users.
I have a problem regarding hiding rows in my excel book depending on the content of each cell.
To begin with its pretty forward, hide all rows where the sum of all cells equals 0.
But the tricky part is where i want the rows with cells that says something with total?
It can be any sentence, but it always contains the string total.
And i cant solve it.

So could someone please help me?

/Fredrik
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Ok that helps... Now what column is the total in??
To add a question to Solosideshow's question... what does the text that contains the total look like? You said "It can be any sentence, but it always contains the string total"... is there anything about the text that will help us to know where the total is? For example, is the total always the last "word" in the text? Or is it always preceeded by the word "Total" (proper case) followed by a colon which is, in turn, followed by a space? Something else that we can use to recognize the number?
 
Upvote 0
To add a question to Solosideshow's question... what does the text that contains the total look like? You said "It can be any sentence, but it always contains the string total"... is there anything about the text that will help us to know where the total is? For example, is the total always the last "word" in the text? Or is it always preceeded by the word "Total" (proper case) followed by a colon which is, in turn, followed by a space? Something else that we can use to recognize the number?
Yes and is it always 0 if nothing?
 
Upvote 0
Well If this helps you.. This is what I got

Rick if you would like to check me make sure i am right..

Code:
Sub Test()
Dim CheckFor0, TotalCells As String


TotalCells = Application.CountA(Range("J1:J200"))    'Change the Cell Label you need to.. but this is just counting how many Totals there are


For CheckFor0 = 1 To TotalCells
        If Range("J" & CheckFor0).Value = "0" Then
            Rows(CheckFor0).Select
            Selection.Delete Shift:=xlUp
            CheckFor0 = CheckFor0 - 1    ' Since We deleted the row we must go back one number to chack the row that replaced it.
        Else
            'do nothing Next search
        End If
        
Next CheckFor0
        
        


End Sub

If that doesn't get what you looking for let me know..
 
Last edited:
Upvote 0
Thank you very much all for your help, but to answer an earlier question, Total is only preceeded by space no colon or any other symbol. And no symbol after Total either.
I will try the example provided by, Solosideshow.

Thanks again.

/Fredrik
 
Upvote 0
Thank you very much all for your help, but to answer an earlier question, Total is only preceeded by space no colon or any other symbol. And no symbol after Total either.
I will try the example provided by, Solosideshow.

Thanks again.

/Fredrik
post a screen shot of how your sheet is set up.. But remove anything that we shouldn't see. That could help us to
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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