+ Reply to Thread
Results 1 to 6 of 6

hide rows based on value in specific column

  1. #1
    Registered User
    Join Date
    07-05-2017
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    19

    hide rows based on value in specific column

    Right now we have specific code to hide certain rows. It checks if in three different ranges if there is no value in a row and hides this row. This works very good.

    However we now need to hide the rows when the value in column 5 of a row is equal to "0,00". The ranges where we need to check this do not have to be changed.
    I already tried a lot of different methods, but can't get it working.

    The current code is:

    Please Login or Register  to view this content.

    Can somebody help me out.

    Thanks in advance.

    Berend-Jan
    Last edited by beejay67; 02-20-2020 at 07:26 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: hide rows based on value in specific column

    Administrative Note:


    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    07-05-2017
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    19

    Re: hide rows based on value in specific column

    Thanks, amended my post with the correct tags
    Last edited by beejay67; 02-20-2020 at 10:52 AM.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: hide rows based on value in specific column

    Hi

    This question really should be a FAQ. I see it time and time again and looping just isn't the best way of doing this sort of thing.

    Whenever you find yourself creating looping code stop and think is this really necessary? Most of the time it isn't. Loops are inherently slow when they have to jump back and forth between VBA and the Excel application - there's a big time overhead at each pass through the loop.

    The fastest, most efficient and elegant way for this sort of stuff is to use an Autofilter to filter the rows you're interested in.
    Then use syntax like

    Please Login or Register  to view this content.
    i.e.deal with a whole block of rows with one instruction rather than many as you process a loop

    Untested in the absence of a workbook but something like

    Please Login or Register  to view this content.
    Change the row range as appropriate, or better still create a dynamic range name for the rows and use the range name

  5. #5
    Registered User
    Join Date
    07-05-2017
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    19

    Re: hide rows based on value in specific column

    Dear Richard,


    Thanks for your response. However do not think this works for my issue, although it is difficult to judge, because my knowlegde of VBA is rather limited.
    perhaps it helps if I enclose a picture of my worksheet.
    What I need is code to check on this worksheet in three ranges if the value in the third column is equal to 0
    If so that specific row needs to be hidden.
    The three ranges are:
    A5:A24
    A33:A37
    A46:A50

    Hope this clarifies it a bit more. Hope you can assist.


    Attachment 664264

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: hide rows based on value in specific column

    Hi,

    I don't see why the block hide as I described earlier wouldn't work. Sometimes it may be necessary to use a helper column with a compound formula that identifies whether a particular row should be hidden.

    However please upload the actual workbook. Pictures are rarely much use. We need the workbook if only to test a solution.

+ 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 to hide specific rows based on 2 variables
    By BC90 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-11-2019, 05:26 AM
  2. [SOLVED] Need code to hide specific rows based on different cell value
    By majzeln in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-04-2016, 02:02 PM
  3. How do I hide specific rows based on values in a different worksheet?
    By mgolou in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-12-2014, 01:04 PM
  4. To hide/unhide rows based on specific value in a cell.
    By @jerry in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-28-2014, 11:56 AM
  5. [SOLVED] First unhide all rows - then hide rows based on specific cell value for a range of cells
    By robbiekh in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-22-2013, 05:46 PM
  6. Replies: 0
    Last Post: 06-11-2012, 02:36 PM
  7. Show/Hide Specific set of Rows based on Criteria in one cell
    By mrgillus in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-11-2010, 01:26 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