Solved

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

Posted on 2006-06-14
3
188 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses
Course of the Month8 days, 15 hours left to enroll

615 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