Solved

Excel VBA to hide Rows of Command Buttons that have no data

Posted on 2006-06-14
3
184 Views
Last Modified: 2010-04-30
I am using Excel VBA

I have a command button that you click to process, it calculates and puts data in the Range of A28:Q57 depending of the scenarios.   It may put data into A28:Q40, etc.

In column G28:G57 I have command buttons all the way down.  I want the rows that have no data in them, but have the command button, to hide the rows.

I start with this and not sure where to go from here
With Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)

Any help would be appreciated.
0
Comment
Question by:ca1358
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
[ fanpages ] earned 500 total points
ID: 16907903
Note quite sure what you need, but this code can be placed inside the _Click() event on any of the Command Buttons.  It will hide any row between 28 & 57 (inclusive) that does not contain any data...

Dim lngRow As Long

For lngRow = 28 to 57
    If Application.CountA(Rows(lngRow)) = 0 Then
       Rows(lngRow).Hidden = True
    End If
Next lngRow

'

BFN,

fp.
0
 

Author Comment

by:ca1358
ID: 16921229
Thank you!
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 16924433
You're very welcome.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question