Hi Everyone,
How can I hide rows depending on the value in a column. I have a spreadsheet where column A is calculated as the sum of columns B to G. If this value is 0 I want to hide the row. From searching online I have found the following but cant get it to work:
---------------------------
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Intersect(Target, Range("A2:A100")) Is Nothing Then
If Target.Value = 0 Then Target.EntireRow.Hidden = True
End If
End Sub
---------------------------
As a complete beginner to Macros where do I put this? I have tried right clicking the Tab, selecting view code, and pasting it into the screen. This hasn't worked. Do I need to do something to activate or run it? Can the code be set up so it constantly runs, so whenever a value on the sheet is changed rows will automatically be hidden or unhidden?
Thanks,
Ger
Bookmarks