conditional formatting

R

RichardO

Hello All:

I would like to hide rows when column A has the word Total, how do
do that in Excel?

Thanks a lot.


Richard
 
G

Gord Dibben

Richardo

Conditional Formatting cannot hide rows. CF could change the text and
background color to make it invisible.

Actually hiding the row would require worksheet event code.

Option Compare Text
'allows for non-case sensitive
Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim cell As Range
Application.ScreenUpdating = False
With ActiveSheet.UsedRange
.Rows.Hidden = False
For Each cell In .Columns(1).SpecialCells(xlCellTypeConstants)
If cell.Text Like "Total" Then cell.EntireRow.Hidden = True
Next cell
End With
End Sub

Right-click on the worksheet tab and "view code".

Copy/paste the above code in there.

If any other code lines appear in the module, delete them.

Gord Dibben Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top