+ Reply to Thread
Results 1 to 3 of 3

Delete & Hide Rows in a Worksheet based on the Value of a Cell in another Worksheet

  1. #1
    Registered User
    Join Date
    08-25-2014
    Location
    New York, New York
    MS-Off Ver
    Excel 2013
    Posts
    36

    Delete & Hide Rows in a Worksheet based on the Value of a Cell in another Worksheet

    I have a workbook that contains two sheets. The first Sheet is "Sheet A", the Second is "Sheet B". I want Rows 34 thru 45, 147 thru 160 to delete automatically in Sheet B and Rows 203 thru 208 and Rows 211 thru 221 to be hidden when on the Value of Cell C16 in Sheet A is "YES". Can you help me write a VBA module for this? Thanks.

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

    Re: Delete & Hide Rows in a Worksheet based on the Value of a Cell in another Worksheet

    This is an even macro that goes in the Sheet A sheet code module. Right-click Sheet A tab and select VIEW CODE, then paste in this code:
    Please Login or Register  to view this content.
    ,
    Note - I find this requested code to be extremely dangerous. Once you delete rows 34:45, 147:160, the rows 203:208, 211:221 are no longer in those row positions. If you do anything to edit C16, even just typing YES again in that cell, it will delete the CURRENT 34:45, 147:160 rows again. Very dangerous code.
    _________________
    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!)

  3. #3
    Registered User
    Join Date
    08-25-2014
    Location
    New York, New York
    MS-Off Ver
    Excel 2013
    Posts
    36

    Re: Delete & Hide Rows in a Worksheet based on the Value of a Cell in another Worksheet

    Thank you - this worked perfectly and I appreciate the heads up about the type of code. I have one other question - if I want to add another Sheet "Sheet C" to Hide Rows 67 thru 89 with this same condition - how can I modify the code?

+ 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] Delete rows on 2 different worksheets based on cell value from one worksheet
    By D.Lovell in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-08-2014, 04:14 AM
  2. Macro to hide rows on a worksheet, based on a cell's value on another worksheet.
    By buttercup116 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-29-2014, 10:47 AM
  3. Replies: 4
    Last Post: 05-08-2012, 10:28 AM
  4. Hide/Unhide Rows in One Worksheet Based on Values in Cells in Another Worksheet
    By xponent_es in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-27-2011, 03:26 PM
  5. VBA to hide rows based on cell value in another worksheet
    By jamesstorx in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-30-2010, 05:07 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