+ Reply to Thread
Results 1 to 8 of 8

Insert Row Depending on Cell Value

  1. #1
    Registered User
    Join Date
    06-29-2008
    Location
    Perth, Australia
    MS-Off Ver
    MS Office 2003
    Posts
    87

    Insert Row Depending on Cell Value

    I have a worksheet in which the cell in column B of the membership list contains a 'Y' or a 'N', depending on whether someone is a member or not.

    I want to write a macro, whereby, on clicking the macro button, only rows with a 'Y' will show. Rows with a 'N' will be hidden.

    Any help appreciated.

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Insert Row Depending on Cell Value

    Hi BazzaBoy

    I'd think you may need two buttons. See attached.

    John
    Attached Files Attached Files
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    06-29-2008
    Location
    Perth, Australia
    MS-Off Ver
    MS Office 2003
    Posts
    87

    Re: Insert Row Depending on Cell Value


    Thanks jaslake,

    I am a non-programmer. So, I only know how to work with simple macros. Can you show me how you have connected the command buttons to the VBA code?

    I already have the following code under sheet1:
    Please Login or Register  to view this content.

    Can we not just do it with sinple macros and macro buttons?

    Thanks.

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Insert Row Depending on Cell Value

    The code you have displayed goes into the worksheet module not a regular module, you cannot attach a button to a worksheet module.
    Right click on the sheet tab and select view code, copy and paste the code there. When there is a change in "B8:B100,G8:J100"
    The code will activate.

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Insert Row Depending on Cell Value

    Hi BazzaBoy

    The code I provided in the attached workbook does this
    on clicking the macro button, only rows with a 'Y' will show. Rows with a 'N' will be hidden
    If you need something further, you'll need to describe/show what it is you need to do.

    John

  6. #6
    Registered User
    Join Date
    06-29-2008
    Location
    Perth, Australia
    MS-Off Ver
    MS Office 2003
    Posts
    87

    Re: Insert Row Depending on Cell Value

    Thanks davesexcel ,

    All sorted out.

    You may mark this thread as SOLVED.

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Insert Row Depending on Cell Value

    Must be late. I'm a little confused.

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Insert Row Depending on Cell Value

    Quote Originally Posted by BazzaBoy View Post
    You may mark this thread as SOLVED.
    That's your job, hehe. Click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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