+ Reply to Thread
Results 1 to 2 of 2

Add to existing VB code to auto hide and show rows based on a certain cell value

  1. #1
    Registered User
    Join Date
    06-20-2013
    Location
    US
    MS-Off Ver
    Office 365
    Posts
    53

    Add to existing VB code to auto hide and show rows based on a certain cell value

    Sorry I cannot share my file as it's super large and would break if I strip things out of it and it would take way too long to remove all confidential data.

    2 tabs are affected by what I'm doing/or trying to do here:
    - Tab 1 is named "Weekly Review"
    - Tab 2 is named "Hidden - Weekly Pivots"

    The following code, thanks to WBD, works perfectly.
    This code updates 6 pivot tables on tab 2 when any 1 of 4 named cells changes (see the 4 named cells below all starting with "fld").
    Along with the pivot table refresh, there's a Form/Timed Message Box that shows to the user telling them that the update is in progress, this msg box auto closes in approx. 15 seconds, and then a 2nd Message Box appears telling the user the update is complete. The user hits OK to close this 2nd message box.

    Please Login or Register  to view this content.

    Here's what I'm trying to add to the above.
    - If "fld_SelectWeeklyPullRangeType" (which is a 2 list drop-down) changes to "Latest # of Weeks", then
    - Show rows 3-4 and Hide rows 5-9
    - If "fld_SelectWeeklyPullRangeType" is changed to "Date Range", then
    - Show rows 5-9 and Hide rows 3-4

    Here's the updated code where I added 7 additional lines of code, all commented out currently because with these new lines the code does nothing now and I do not know why.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Add to existing VB code to auto hide and show rows based on a certain cell value

    I stared at this for a while and could only guess that the values "Latest # of Weeks" and "Date Range" do not match the values in the cell exactly. If you want to check whether the lines are being executed then put a breakpoint on the line (highlight the line and hit F9) then go back to the sheet and change the value and check to see what's happening. If you put the break on the first If statement then you can step through the code using F8 and just run the remaining code using F5. You can also highlight variables and expressions and hit Shift+F9 to check the values.

    WBD
    Office 365 on Windows 11, looking for rep!

+ 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. "VBA code to hide/show rows based on multiple selection of drop down list.
    By NASANASA in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-02-2020, 05:07 PM
  2. Hide or Show rows based off value of cell in that row?
    By dancor31 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 05-17-2017, 01:38 PM
  3. [SOLVED] Auto-hide/show Rows based on Yes/No Criteria
    By jakeruby in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-20-2015, 04:04 PM
  4. Show Hide Rows based on cell value
    By Juicy2052 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-13-2015, 07:55 AM
  5. VBA code to hide/show rows based on value in each row
    By KEM4321 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-11-2012, 01:19 PM
  6. Code to show/hide rows based on Y
    By Justinmih in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-03-2011, 06:12 PM
  7. Auto Hide/Show Lines based on Data in cell
    By tariqnaz2005 in forum Excel General
    Replies: 5
    Last Post: 12-29-2009, 03:30 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