![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: John G
Posts: 62
|
How can I set a print area from a known range and then print it. I have tried:
Dim myrange As Range Workbooks(fname).Worksheets("Invoice").Activate Set myrange = Workbooks(fname).Worksheets("Invoice").Range("A5:L48") ActiveSheet.PageSetup.PrintArea = myrange.address This code errors out on the Activesheet.pagesetup.printarea = myrange.address John |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Feb 2002
Location: John G
Posts: 62
|
I think part of my problem is that I'm trying to run this code from a userform. Any suggestions about how I can fix this?
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Posts: 3,064
|
Hi
How are you triggering the code with assignment from a button on that userform? try adding another and reset to that script. Or can you not add a command button outside the sheet and test if its the userform error or is really the code.
__________________
Free Excel based Web Toolbar available here. Jack in the UK J & R Excel Solutions "making Excel work for you" |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|