+ Reply to Thread
Results 1 to 4 of 4

VBA to Hide and Show Rows

  1. #1
    Registered User
    Join Date
    03-09-2016
    Location
    UAE
    MS-Off Ver
    2007
    Posts
    7

    VBA to Hide and Show Rows

    Hi,
    I have 2 worksheets in a workbook with below names.

    1) Input
    2) Output

    Input is where users can enter data in given fields.
    Output is where the data entered in Input is reflected through cell referencing.

    Question: It is possible to have a VBA for hiding/showing all those cells which are blank in the output. So that the data is compressed to only what is available or entered by the user in Input for print purpose?

    Blank refers to, the user has not entered any data in the corresponding input field thus the output where the cell reference is in place will not show any result.

  2. #2
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: VBA to Hide and Show Rows

    Was not quite sure what you really wanted but see if some of this points you in the correct direction.
    The subs assume that data is in A2 to Z1000 with headers in row 1 and in column A
    Rows will be hidden if columns B to Z blank
    or if rows B to Z not blank
    The 3rd sub unhides all the rows

    If this is not what you want, then please attach a workbook with one sheet showing the "before hiding" appearance
    and another sheet showing the "after hiding" appearance


    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    End Sub
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-09-2016
    Location
    UAE
    MS-Off Ver
    2007
    Posts
    7

    Re: VBA to Hide and Show Rows

    Hi Kevin#

    I have attached my file.

    So in the output sheet, if any of the values in all domain is blank. That particular domain and its value area is to be hidden.

    Thanks
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: VBA to Hide and Show Rows

    One way to achieve this is to use conditional formatting, selecting the whole of the range that depends on the same condition, and make both background and text colour WHITE if condition is met. Makes it disappear on the screen.

    Range Selected = B14 to M21

    Formula used for conditional formatting:

    =COUNTIF($F$16:$M$21,"")>0
    which translated into English says to apply the formatting if there is at least one cell in that range whose value =""

    You could apply a similar condition to the other ranges and domains

    see attached file
    Look at the rule in Conditional Formatting/Manage Rules
    Attached Files Attached Files

+ 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. ComboBox VBA to Hide/Show Rows
    By Guilherme95 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-25-2015, 04:40 PM
  2. Show/Hide rows
    By Len Silva in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-18-2015, 04:54 PM
  3. Hide and show rows
    By etunges in forum Excel General
    Replies: 2
    Last Post: 07-13-2011, 09:19 AM
  4. Hide Rows/Show Rows - Check box
    By Audsmom in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-04-2011, 03:02 AM
  5. [SOLVED] Hide Rows - copy and paste only rows that show
    By Access101 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-28-2006, 08:50 PM
  6. Hide rows but show when printing
    By dyukon in forum Excel General
    Replies: 1
    Last Post: 01-16-2006, 01:10 PM
  7. [SOLVED] Hide and show Rows
    By Duane in forum Excel General
    Replies: 2
    Last Post: 04-19-2005, 06:06 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