PDA

View Full Version : [SOLVED:] Hiding Rows



Ladyj205
06-05-2018, 10:15 AM
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/ (https://www.mrexcel.com/forum/redirect-to/?redirect=https%3A%2F%2Funsee.cc%2Fc831aaa4%2F)


i appreciate all the help on this thanks :)


i want it to look like this https://unsee.cc/ce403f89/

Paul_Hossler
06-07-2018, 09:38 AM
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?

Ladyj205
06-08-2018, 06:17 AM
i figured it out. i was trying to delete the thread lol

SamT
06-09-2018, 07:21 AM
LadyJ,

Please post your solution so others can learn.

Thanks.