+ Reply to Thread
Results 1 to 2 of 2

If 2 cells contain hide selection

  1. #1
    Forum Contributor
    Join Date
    10-24-2008
    Location
    England
    Posts
    146

    If 2 cells contain hide selection

    Hi
    If cells b4 and b5 both contain certain values at the same time i want to hide rows 7 to 12 but when i click on b4 or b5 the cells unhide.

    How can this be done

    ive been playing around with this but it wont work properly

    show0hide1 = 1 'put 0 to show, put 1 to hide
    row2chk = "$38:$47" 'row range to check if G on that row is blank
    For rw = Range(row2chk).Cells(1).Row To Range(row2chk).Cells(Range(row2chk).Cells.Count).Row
    If Range("B4" & rw).Value <> "29" And Range("G" & rw).Value <> "Single" Then Range("A" & rw).EntireRow.Hidden = show0hide1
    Next

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454
    Hi,

    You need this code to go into the private module of the worksheet object.

    On the sheet you want this to happen on, right click the tab, and go to View Code

    Paste this code in

    Please Login or Register  to view this content.
    This checks if the value of B4 and B5 is 8, and if it is hides rows 7:12
    When you select B4 or B5, Rows 7:12 are unhidden
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

+ Reply to Thread

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