Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I have data constantly changing from using 100 to 1500 lines and when it comes to printing, I have to constantly set the print area or drag the print preview handles. Is there a way that a piece of code can find the last occupied cell in a column and have the page set up change accordingly? Many thanks in advance John |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
John,
With ActiveSheet .PageSetup.PrintArea = .UsedRange.Address End With NickHK "JohnUK" wrote in message ... Hi I have data constantly changing from using 100 to 1500 lines and when it comes to printing, I have to constantly set the print area or drag the preview handles. Is there a way that a piece of code can find the last occupied cell in a column and have the page set up change accordingly? Many thanks in advance John |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Nick, thanks for your help.
I have tried it, but it doesnt work, maybe because I have formulas that run down each side of the data that I want printed!! John "NickHK" wrote: John, With ActiveSheet .PageSetup.PrintArea = .UsedRange.Address End With NickHK "JohnUK" wrote in message ... Hi I have data constantly changing from using 100 to 1500 lines and when it comes to printing, I have to constantly set the print area or drag the preview handles. Is there a way that a piece of code can find the last occupied cell in a column and have the page set up change accordingly? Many thanks in advance John |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi John,
With ActiveSheet .PageSetup.PrintArea = intersect(.UsedRange.Address,range("a:b")).address End With Change "a:b" to be columns you want printed. Regards, Ivan |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Ivan - again
It comes back as a run time error - object required Any ideas ? John "Ivan Raiminius" wrote: Hi John, With ActiveSheet .PageSetup.PrintArea = intersect(.UsedRange.Address,range("a:b")).address End With Change "a:b" to be columns you want printed. Regards, Ivan |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi John,
sorry, should be: intersect(.UsedRange,range("a:b")).address Regards, Ivan |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
John,
I'm sure Ivan will see it, but remove the .address from .usedrange. NickHK "JohnUK" wrote in message ... Hi Ivan - again It comes back as a run time error - object required Any ideas ? John "Ivan Raiminius" wrote: Hi John, With ActiveSheet .PageSetup.PrintArea = intersect(.UsedRange.Address,range("a:b")).address End With Change "a:b" to be columns you want printed. Regards, Ivan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
set area in excel not giving me option to set print area? | Excel Discussion (Misc queries) | |||
File, print area, clear area, is not working | New Users to Excel | |||
print area across the freeze panes area | Excel Worksheet Functions | |||
Macro - Set Print Area for Changing Data Area | Excel Programming | |||
How do you turn off a print area for a page? (no print area) | Excel Discussion (Misc queries) |