ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Add rows after hiding rows (https://www.excelbanter.com/excel-discussion-misc-queries/174219-add-rows-after-hiding-rows.html)

eshoobee1

Add rows after hiding rows
 
I have a project that hides a row in the print area when a specified column
in that row equals zero. The number of hidden rows varies depending on user
input. I need a way to add the same number of blank rows at the end of the
list of printed rows so that the size of my print area does not change. An
suggestions?

FSt1

Add rows after hiding rows
 
hi
since you didn't post any code, i can only guess and assume that your
project is code and that you are going down a list in a loop to hide the zero
rows.

dim c as long
c=c+1 'add this just after the line that hides the zero row

you could add a counter to count the number of rows that are hidden.
then after your loop, you can add the count of hidden rows back in.
Range("A1").End(xlDown).Offset(1, 0).Select 'go to end of data
For i = 1 To c
ActiveCell.EntireRow.Insert shift:=xlDown
Next i

my thoughts
Regards
FSt1

"eshoobee1" wrote:

I have a project that hides a row in the print area when a specified column
in that row equals zero. The number of hidden rows varies depending on user
input. I need a way to add the same number of blank rows at the end of the
list of printed rows so that the size of my print area does not change. An
suggestions?



All times are GMT +1. The time now is 07:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com