conditional formatting

  • Thread starter Thread starter RichardO
  • Start date Start date
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
 
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
 
Back
Top