macro to copy/paste print area

S

SteveDB1

Hi all.
what would be involved in creating a macro that would read only the contents
of a worksheet within a pre-defined area of the print field?
Thank you.
 
F

FSt1

hi
what do you mean by "read" only the print area.
excel looks at the print area as a name range and the name "Print_Area" even
appears in the name box and name dialog.
this line will select the print area
sub somesubname()
Range("print_area").select
end sub
but i don't think that's what you want.

post back with more info.
regards
FSt1
 
S

SteveDB1

sorry about being so simplistic.
I've been trying to figure out how detailed to get, without being to
concise, as I've had really concise posts go unresponded to, and really to
somehwat vague posts get all kinds of responses.

what I want to accomplish is to have it look at the area I show as a "print
field" and then copy just that area in to a new worksheet. Part of the
problem is that I have equations, comments, and other data on the worksheet
that I don't want copied.

I've been looking around and have found a couple of macros that set a print
area based on the used range. but since I have more cells with data in them
than I normally print, I just want to pick the predefined area that we
normally print from.

Does that explain enough?
Thank you for your help.
Best.
 
F

FSt1

hi
sorry it took so long to get back. got hung up.
your request seems simple enough. an old lotus save range macro.
sub steveDB1saverange()
range("Print_Area").copy
workbooks.add
Activesheet.paste
Application.Dialogs(xlDialogSaveAs).Show
end sub
macro assumes the print area is already set.
and i hope all the "equations, comments, and other data" are outside the
priint area because the copy command cann't copy multiple areas at once.

hope this helps
regards
FSt1
 
S

SteveDB1

Hi FSt1,
No worries about time. Hope all is well.
Ok, I just tested the code, and it rejects the "Print_area" so I'm guessing
I need to define that area more concisely?

How do I accomplish that? My print area will vary from workbook to workbook,
so having a <variable> "Print_Area" is critical.

I did find this topic in help, and it only discusses the use for
establishing/creating a print area, not one that's undefined-- beyond what I
have already.

Again-- thank you for your help.
 
S

SteveDB1

FSt1,
I went back over the code you gave again, and changed it once again-- back
to what you gave. It works now. I don't know why it didn't work before, but
it rejected the global use, and after trying three variations on it, I reset
it to the original Print_Area and it now works. go figure! I'm guessing it's
a Friday thing.
Thank you.
 

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