+ Reply to Thread
Results 1 to 6 of 6

VBA to hide and unhide rows depending on a value placed in another cell

  1. #1
    Forum Contributor
    Join Date
    11-07-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    126

    VBA to hide and unhide rows depending on a value placed in another cell

    Hi all,

    I am looking for a VBA that will do the following,

    Dependant on what number is entered in a certain cell i.e B2 rows within the same sheet will hide or unhide and certain contents of the hidden cell get deleted

    I.e
    I type 1 into cell b2 and rows 7-10 are hidden and cells b5,f5 and i5 are deleted

    I type in 2 and cells 8-10 are hidden and cells b5,f5 and i5 are deleted.


    Any help would be appreciated

    Thanks




    Sent from my iPhone using Tapatalk

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,914

    Re: VBA to hide and unhide rows depending on a value placed in another cell

    Maybe Google: excel vba to hide rows based on cell value

    You'll find lots of references.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    11-07-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    126

    Re: VBA to hide and unhide rows depending on a value placed in another cell

    Hi TMS,

    Yep I have tried that, still struggling.


    Sent from my iPhone using Tapatalk

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,914

    Re: VBA to hide and unhide rows depending on a value placed in another cell

    Probably better for your learning to find an example and try to adapt it to your needs. But ..

    Please Login or Register  to view this content.

    Regards, TMS

  5. #5
    Forum Contributor
    Join Date
    11-07-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    126

    Re: VBA to hide and unhide rows depending on a value placed in another cell

    Thank you for the help this has worked perfectly and I have managed to tweak the code to remove data from the rows about to be hidden.

    I had been searching for quite a few hours on Saturday and testing the answers I found but it didn't appear to be working. Unless excel was being temperamental.




    Sent from my iPhone using Tapatalk

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,914

    Re: VBA to hide and unhide rows depending on a value placed in another cell

    You're welcome.


    Unless excel was being temperamental.
    as if ...



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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] Hide/unhide cells depending on independent cell value
    By aaron061883 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-01-2013, 08:20 PM
  2. Hide/Unhide Columns Depending on a specific cell value
    By DaveM13 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-19-2012, 06:01 PM
  3. [SOLVED] Hide/Unhide picture depending on what's in a cell
    By r5swank in forum Excel General
    Replies: 1
    Last Post: 05-29-2012, 04:52 PM
  4. hide unhide button depending on cell value
    By MarcoAUA in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-25-2012, 09:29 PM
  5. unhide or hide rows depending on previous row value
    By tinkerbelle in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-19-2010, 08:54 AM
  6. Hide/Unhide Columns Depending on cell value
    By taghos7777 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-13-2009, 08:36 PM
  7. hide/unhide rows depending on the top input value
    By TiDz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-07-2006, 05:55 AM
  8. hide/unhide rows depending on the top input value
    By TiDz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-07-2006, 04:05 AM

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