+ Reply to Thread
Results 1 to 10 of 10

for statement for hiding rows VB

  1. #1
    Forum Contributor
    Join Date
    06-17-2007
    Posts
    113

    Post for statement for hiding rows VB

    In VB, how would the following look:

    Please Login or Register  to view this content.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: for statement for hiding rows VB

    If the values in H are true blanks (ie not formula nulls) then

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    06-17-2007
    Posts
    113

    Re: for statement for hiding rows VB

    But I need a loop to go down a column and then hide each row that is blank in column H

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: for statement for hiding rows VB

    Why do you "need to loop" - if you can avoid looping do so.

  5. #5
    Forum Contributor
    Join Date
    06-17-2007
    Posts
    113

    Re: for statement for hiding rows VB

    well say the excel file looks like this
    Please Login or Register  to view this content.
    Now at the click of a button if column H in a cell doesnt have an x (IE: its blank), will that code hide that row?

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: for statement for hiding rows VB

    will that code hide that row?
    ...one way to find out...

    it depends in part on how the x's are populated... are they manually inserted or result of formulae ?

  7. #7
    Forum Contributor
    Join Date
    06-17-2007
    Posts
    113

    Re: for statement for hiding rows VB

    yea they are inserted manually and yea that code works, Just as a add on is it possible to instead of typing, be able to click and it adds something, eg: check box, so I dont have to use the keyboard?

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: for statement for hiding rows VB

    You mean to add the "X" ?

    I would probably opt for a double-click event, ie:

    Please Login or Register  to view this content.
    The above would need to reside in the Sheet Object in VBE ... ie right click on tab against which the above is to be applied, select View Code and paste into resulting window.

  9. #9
    Forum Contributor
    Join Date
    06-17-2007
    Posts
    113

    Re: for statement for hiding rows VB

    Yep that will do, cheers

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: for statement for hiding rows VB

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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