grid lines printing with blank cells

R

rabblerowzer

Hi,

I have a Macro that inserts gridlines into rows A50: F100, It
accommodates varied lengths of lists that start always start at row
50, and sometimes extend to row 100. Usually it only goes down about
20 rows to row #70. In that case, is there a way that I can prevent
the gridlines with blank cells in rows 71-100 from printing
automatically?

I would prefer it if there were some method that "automatically"
recognizes the text stops at row 70, so that it does not print the
gridlines from 71-100 if there is no text in them.

Do you know of a method to do that? I looked at the print gridlines
function in page setup, but that insets gridlines everywhere. I just
want gridlines past row 50.

Thanks,
 
G

Guest

Can we see your macro?

I suspect that you can use some variation of a statement like this to
determine the last row actually used on the sheet before you apply the
gridlines (borders?)

lastUsedRow = Range("A" & Rows.Count).End(xlUp).Row

You could use the value returned to adjust the range that you use to set up
the lines.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top