+ Reply to Thread
Results 1 to 4 of 4

Hide rows based on values upto

  1. #1
    Registered User
    Join Date
    02-19-2018
    Location
    Surrey
    MS-Off Ver
    2010
    Posts
    9

    Post Hide rows based on values upto

    Hi folks,

    I am making a right mess of this...
    Amateur hour.
    Could use a pro.

    My aim is to hide difference rows based on which number is in a cell.

    Upto the following
    <=250
    <=7500
    <=375000
    <=1875000

    My mangled macro is below. Apologies if it reads poorly. Any help would be greatly received.
    -----------------------------------------------------------------------------------------
    Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Address = "$I$36" Then

    Select Case Range("I36").Value
    Case Is = Range.Value <= 250:
    Rows("40:52").EntireRow.Hidden = True
    Rows("40:41").EntireRow.Hidden = False
    Case Is = Range.Value <= 7500:
    Rows("40:52").EntireRow.Hidden = True
    Rows("43:44").EntireRow.Hidden = False
    Case Is = Range.Value <= 375000:
    Rows("40:52").EntireRow.Hidden = True
    Rows("46:47").EntireRow.Hidden = False
    Case Is = Range.Value <= 1875000:
    Rows("40:52").EntireRow.Hidden = True
    Rows("49:50").EntireRow.Hidden = False
    End Select

    End If

    End Sub

  2. #2
    Forum Contributor
    Join Date
    01-03-2018
    Location
    Fukuoka, Japan
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: Hide rows based on values upto

    Hi, VaughanCarver.
    I've modified your code like below. Hope it works.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-19-2018
    Location
    Surrey
    MS-Off Ver
    2010
    Posts
    9

    Re: Hide rows based on values upto

    You are a hero.

    Thank you very much for your assistance.

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,777

    Re: Hide rows based on values upto

    There seems to be some contradiction in your code. For example, if I36 = 10 then rows 40:52 will be hidden but then the next line of code unhides rows 40:41. Why hide them in the first place? Why not say if I36 = 10, then make rows 43:52 visible?
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro for Hide & Unhide the rows upto a certain column
    By Neilesh Kumar in forum Excel General
    Replies: 11
    Last Post: 09-14-2017, 10:08 AM
  2. Hide rows based on same values in cell
    By henk400 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-10-2015, 01:55 AM
  3. How do I hide specific rows based on values in a different worksheet?
    By mgolou in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-12-2014, 01:04 PM
  4. Need help to show/hide rows based on values from a cell
    By concurmgr in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-19-2012, 02:56 PM
  5. Hide rows based on multiple column values
    By dtanios in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-07-2012, 02:09 PM
  6. Hide Rows based on cell values
    By Chinny123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-23-2011, 08:45 AM
  7. Hide rows based on cell values
    By mlb830 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-18-2009, 05:05 PM

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