• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Creating a Command Button that will also show rows

wynama

New Member
Good Morning!


So I am trying to create a sheet that will group all the data together on a master sheet, without making a lot of mess. So far, I have the obvious paste link bit working, but because there are a number of rows that are always changing, I have to paste in rows with no value, on the off chance that row becomes active. This has led to a sheet with rows and rows of 0 value data. I have managed to create command button that, when clicked, will eliminate all the 0 values without any trouble, using this code:


Sheets("Summary Sheet").Select

Range("B1:B600").Select

For Each cell In Selection

If cell = 0 Then

Range(cell.Address).EntireRow.Hidden = True

End If

Next


But what I can't figure out is how to make it show rows once a value has been input. Unfortunately, it isn't a 0 or 1, it's either 0 or text. I have no idea what to do now.
 
Hi wymama,

If I understood correctly, this should work :


Sub ShowRows()

Dim c As Range

Application.ScreenUpdating = False

For Each c In Sheets("Summary Sheet").Range("B1:B600")

c.EntireRow.Hidden = False

If c = 0 Then c.EntireRow.Hidden = True

Next c

Application.ScreenUpdating = True

End Sub


Note : Try to avoid the .Select, it slows down your code...


Cheers!
 
Oh wow! That works perfectly, thanks very much, GCExcel! I really appreciate it! Thanks for the tip, too, the code is much faster without the .select
 
@GCExcel


Hi!

I saw that your blog is in french and that the domain is .com.ar. Frenchman settled in Argentine?


Bonjour! J'ai vu qui votre blog est en français et qui le domaine c'est .com.ar. Française installée ici en Argentine?


Regards & Salut!


PS: BTW I suscribed it with same nick as here :)
 
Hi,

I'm from Canada (Quebec province).

Domain used to be .com but now I see .ca ??? Weird...

Thanks for suscribing!
 
Back
Top