+ Reply to Thread
Results 1 to 8 of 8

Un/Hide Rows base on cell change for two different cells Un/Hiding different parts of the

  1. #1
    Registered User
    Join Date
    04-10-2020
    Location
    london
    MS-Off Ver
    365
    Posts
    3

    Wink Un/Hide Rows base on cell change for two different cells Un/Hiding different parts of the

    I have a very simple code that works very well to Un/Hide rows when change the cell value of S55. BUT I need a code but works exactly the same for two portions of my sheet independently.

    I mean changing the first cell un/hide some rows at the beggining and on the other side changing another cell at the end of the sheet un/hide others rows differents of the one at the beggining.


    here is the code.


    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim HideRows As Range, ViewRows As Range

    If Intersect([s55], Target) Is Nothing Then Exit Sub

    Select Case [s55].Value
    Case Is = 0
    Set HideRows = Rows("60:298")
    Set ViewRows = Nothing

    End Select
    On Error Resume Next
    HideRows.Hidden = True
    ViewRows.Hidden = False
    End Sub

    Thanks a lot for orientation!

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Un/Hide Rows base on cell change for two different cells Un/Hiding different parts of

    Try something like this. Change the cell and rows to suit.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Un/Hide Rows base on cell change for two different cells Un/Hiding different parts of

    Cross-posted at:
    https://chandoo.org/forum/threads/un...ndently.44047/
    https://www.mrexcel.com/board/thread...ently.1130372/
    https://www.excelguru.ca/forums/show...erent-parts-of
    https://stackoverflow.com/questions/...different-part
    Please read Excel Forum's Cross-Posting policy in rule 8: http://www.excelforum.com/forum-rule...rum-rules.html
    Last edited by macropod; 04-11-2020 at 12:13 AM.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,872

    Re: Un/Hide Rows base on cell change for two different cells Un/Hiding different parts of

    It seems that you have ignored 2 of our forum rules that you agreed to abide by when you joined. You have crossposted at several sites. You have failed to use code tags. Please add code tags to your post. Please reread the forum rules and the link that Paul has provided and abide by the rules in the future.

    No help to be offered this OP until this moderation request has been complied with.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Un/Hide Rows base on cell change for two different cells Un/Hiding different parts of

    Quote Originally Posted by alansidman View Post
    It seems that you have ignored 2 of our forum rules that you agreed to abide by when you joined.
    Same two rules ignored on multiple sites, not just here!

  6. #6
    Registered User
    Join Date
    04-10-2020
    Location
    london
    MS-Off Ver
    365
    Posts
    3

    Re: Un/Hide Rows base on cell change for two different cells Un/Hiding different parts of

    WOOOOOOOW
    Its works THAAANKS A LOT I have been looking an answer for this for a month.
    Now I have to make the code works for different possible values, not only 0 but from 0 to 10 for each of the cells, which in turn according with the value hide or unhide different rows.

    Thanks Again!!

  7. #7
    Registered User
    Join Date
    04-10-2020
    Location
    london
    MS-Off Ver
    365
    Posts
    3

    Re: Un/Hide Rows base on cell change for two different cells Un/Hiding different parts of

    Ooooh Sorry I am new on this

    By the moment I just want to thank again.

    I couldnt manage to make the code works for more than one condition or number equal to, but I will continue researching.

    Have a great day!!!!!!
    Last edited by raulmiho; 04-11-2020 at 01:48 AM.

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,872

    Re: Un/Hide Rows base on cell change for two different cells Un/Hiding different parts of

    Please reread the forum rules and fix your first post to include code tags.

    No help to be offered until this is fixed.

+ 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] Hiding Rows base on InputBox
    By gsandy in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-06-2018, 06:40 PM
  2. Grouped rows, hide/reveal base on cell value
    By JonesyCC in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-21-2016, 09:14 PM
  3. [SOLVED] VBA, hiding cells or hide rows!
    By Raanan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-04-2013, 06:11 AM
  4. Hide Cells in Columns and Rows without hiding all of the Colum or Row
    By choke in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-17-2012, 10:49 AM
  5. Base on column "J" insert new rows & copy formula parts to it
    By johncena in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-08-2011, 07:24 AM
  6. hiding parts of a cell
    By dick in forum Excel General
    Replies: 3
    Last Post: 10-16-2005, 10:05 PM
  7. [SOLVED] hiding parts of a cell
    By dick in forum Excel General
    Replies: 0
    Last Post: 10-16-2005, 08: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