Format page border on print

P

Pete Merenda

I have question similar to the one (with answer) below, but I'm not astute
enough of VB to follow it.

In short, I'd like to place a border around a worksheet range when the
worksheet is printed, but make the border invisible to users when inputing
data (purely asthetics). The range will never change from A1:H33. Can you
advise me on how to insert the border only when the print command is
selected? And after someone prints, my hope would be for the border to still
be invisible on their monitor.

Thanks





What you could do is put the following line of code after your print
activity is completed.

ActiveSheet.Range("A1:S" & lr).Borders.LineStyle = xlLineStyleNone

That will remove the border so you can do other things and then save the file.
If you plan on the column lengths changing and the file being printed during
a single session, then I suggest you put the border commands in separate subs
and use a conditional If ... Then statement to call them as needed. The
border will not automatically move with a change in the size of the database,
but the macro will resize the border each time it is run, based on the size
of the database. Now that I have you thoroughly confused, I'll say good
night.

Scott J said:
Hi everyone,

I was wondering if anyone can help me with some code to dynamically place a
border on the last row of a spreadsheet. The issue for me is that the
spreadsheet varies in length (based on filtering), but the columns are static
(A:S). What I was hoping to do is place a border on the last row so the
spreadsheet will be completly framed out once printed.

Does anyone have any ideas?

Thanks,

SJ
Was this post helpful
 

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