Solved

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

Posted on 2006-06-14
3
183 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

791 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