Macro using relative references

W

warp9

I’m trying to record a macro using the relative reference option in order to
change the print area every time it’s run. The active cell offset reference
appears in the code, yet the print range defaults to the original print area
regardless of where the cursor is placed when the macro is run. What am I
doing wrong?
 
W

warp9

Thanks John.


ActiveCell.Offset(3, 0).Range("A1:M100").Select
ActiveSheet.PageSetup.PrintArea = "$A$701:$M$800"
 
J

John C

Your code is selecting A1:M100, but then printing A701:M800 only.

Change your second line to this:
ActiveSheet.PageSetup.PrintArea = Selection.Address

Hope this helps.
 

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