Consulting

Results 1 to 4 of 4

Thread: Hiding Rows

  1. #1
    VBAX Regular
    Joined
    Apr 2018
    Posts
    50
    Location

    Hiding Rows

    I'm using excel 2010 win 7


    I have rows (18:42) which is 25 rows.


    i want to use a commandbutton that use
    a. two ranges:one will cover the rows starting at 18 to the last hidden row, the other will not be set
    b. Use a For Each loop to go through each row in the first range using the second range as the “each” item (i.e. For Each Range2 In Range1)
    c. If the row (Range2) being checked is hidden set it to shown and then exit the loop
    d. If the row is already shown go to the next row (Next Range2)

    so when you click the button it would show row 18 and when u click again it will show the next row while the other rows are hidden



    so would my code be like

    Option Explicit
    Private Sub CommandButton1_Click()
    Rows("18:42").Select

    If Rows("18:42").Hidden =TrueThen
    Selection
    .EntireRow.Hidden =False
    Else
    Selection
    .EntireRow.Hidden =True
    EndIf

    End Sub

    https://unsee.cc/c831aaa4/


    i appreciate all the help on this thanks


    i want it to look like this https://unsee.cc/ce403f89/
    Last edited by Ladyj205; 06-05-2018 at 12:36 PM.

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    1. The external image links do not work - you can [Go Advanced] at the lower right, and add files

    2. This is marked [Solved] -- is it? There are no replies, so did you figure it out?
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    VBAX Regular
    Joined
    Apr 2018
    Posts
    50
    Location
    i figured it out. i was trying to delete the thread lol

  4. #4
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    LadyJ,

    Please post your solution so others can learn.

    Thanks.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •