Results 1 to 14 of 14

Hide Rows Depending on Values in Column

Threaded View

  1. #1
    Registered User
    Join Date
    03-20-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    27

    Hide Rows Depending on Values in Column

    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
    Last edited by gerainta; 05-15-2012 at 06:40 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1