Solved

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

Posted on 2006-06-14
3
187 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

729 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