View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_4_] Dick Kusleika[_4_] is offline
external usenet poster
 
Posts: 595
Default How do I write a macro that hides a row based on data in Excel?

JJO

You should include your question in the body of your post and use the
subject line to show the subject. It makes it easier for others to read.
Here's an example of a macro that hides a row based on the value of a cell.

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Column = 1 Then 'only for column A
If Target.Value = "HideMe" Then
Application.EnableEvents = False
Target.EntireRow.Hidden = True
Application.EnableEvents = True
End If
End If

End Sub

For more on events, see here
http://www.dicks-blog.com/archives/2...ng-vba-events/

--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com

JJO wrote: