Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to set an area of a filter as a print area, and the way I am
trying to do this is as follows: Filter my results Select the results Give the selection a name Set the named range as the print area I tried recording a macro to do this, but when I set the print area, it gives it specific cells (eg A1:D23). The problem with this is that the area will be different everytime, so can someone please tell me how to do this? cdb |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
See if this works. Apply this to where it sets the print area.
Range("A1:D" & range("D65536").end(xlup).row) This will use the last row in column D with data in it. HTH, Paul "cdb" wrote in message ... I am trying to set an area of a filter as a print area, and the way I am trying to do this is as follows: Filter my results Select the results Give the selection a name Set the named range as the print area I tried recording a macro to do this, but when I set the print area, it gives it specific cells (eg A1:D23). The problem with this is that the area will be different everytime, so can someone please tell me how to do this? cdb |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Post what you have so far and we will just tweak that...
-- HTH... Jim Thomlinson "cdb" wrote: I am trying to set an area of a filter as a print area, and the way I am trying to do this is as follows: Filter my results Select the results Give the selection a name Set the named range as the print area I tried recording a macro to do this, but when I set the print area, it gives it specific cells (eg A1:D23). The problem with this is that the area will be different everytime, so can someone please tell me how to do this? cdb |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here's what I have so far (it's not much):
Range("A4:T4").Select Range(Selection, Selection.End(xlDown)).Select Selection.Name = PrintSelect ActiveSheet.PageSetup.PrintArea = PrintSelect cdb "Jim Thomlinson" wrote: Post what you have so far and we will just tweak that... -- HTH... Jim Thomlinson "cdb" wrote: I am trying to set an area of a filter as a print area, and the way I am trying to do this is as follows: Filter my results Select the results Give the selection a name Set the named range as the print area I tried recording a macro to do this, but when I set the print area, it gives it specific cells (eg A1:D23). The problem with this is that the area will be different everytime, so can someone please tell me how to do this? cdb |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this:
Range("A4:" & Range("T4").End(xlDown).Address).Select ActiveSheet.PageSetup.PrintArea = Selection This may not work if there are blank cells between the data in column T. You can try this as an alternative. Range("A4:" & Range("T65536").End(xlUp).Address).Select ActiveSheet.PageSetup.PrintArea = Selection Good luck. Paul "cdb" wrote in message ... Here's what I have so far (it's not much): Range("A4:T4").Select Range(Selection, Selection.End(xlDown)).Select Selection.Name = PrintSelect ActiveSheet.PageSetup.PrintArea = PrintSelect cdb "Jim Thomlinson" wrote: Post what you have so far and we will just tweak that... -- HTH... Jim Thomlinson "cdb" wrote: I am trying to set an area of a filter as a print area, and the way I am trying to do this is as follows: Filter my results Select the results Give the selection a name Set the named range as the print area I tried recording a macro to do this, but when I set the print area, it gives it specific cells (eg A1:D23). The problem with this is that the area will be different everytime, so can someone please tell me how to do this? cdb |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Neither of those work. I get an error message saying:
Run-time error '1004': Unable to set the PrintArea property of the PageSetup class cdb "PCLIVE" wrote: Try this: Range("A4:" & Range("T4").End(xlDown).Address).Select ActiveSheet.PageSetup.PrintArea = Selection This may not work if there are blank cells between the data in column T. You can try this as an alternative. Range("A4:" & Range("T65536").End(xlUp).Address).Select ActiveSheet.PageSetup.PrintArea = Selection Good luck. Paul "cdb" wrote in message ... Here's what I have so far (it's not much): Range("A4:T4").Select Range(Selection, Selection.End(xlDown)).Select Selection.Name = PrintSelect ActiveSheet.PageSetup.PrintArea = PrintSelect cdb "Jim Thomlinson" wrote: Post what you have so far and we will just tweak that... -- HTH... Jim Thomlinson "cdb" wrote: I am trying to set an area of a filter as a print area, and the way I am trying to do this is as follows: Filter my results Select the results Give the selection a name Set the named range as the print area I tried recording a macro to do this, but when I set the print area, it gives it specific cells (eg A1:D23). The problem with this is that the area will be different everytime, so can someone please tell me how to do this? cdb |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this code by itself. If it works fine, then it must be something in the
surrounding code causing it to fail at this point. Sub test() Range("A4:" & Range("T65536").End(xlUp).Address).Select ActiveSheet.PageSetup.PrintArea = Selection End Sub "cdb" wrote in message ... Neither of those work. I get an error message saying: Run-time error '1004': Unable to set the PrintArea property of the PageSetup class cdb "PCLIVE" wrote: Try this: Range("A4:" & Range("T4").End(xlDown).Address).Select ActiveSheet.PageSetup.PrintArea = Selection This may not work if there are blank cells between the data in column T. You can try this as an alternative. Range("A4:" & Range("T65536").End(xlUp).Address).Select ActiveSheet.PageSetup.PrintArea = Selection Good luck. Paul "cdb" wrote in message ... Here's what I have so far (it's not much): Range("A4:T4").Select Range(Selection, Selection.End(xlDown)).Select Selection.Name = PrintSelect ActiveSheet.PageSetup.PrintArea = PrintSelect cdb "Jim Thomlinson" wrote: Post what you have so far and we will just tweak that... -- HTH... Jim Thomlinson "cdb" wrote: I am trying to set an area of a filter as a print area, and the way I am trying to do this is as follows: Filter my results Select the results Give the selection a name Set the named range as the print area I tried recording a macro to do this, but when I set the print area, it gives it specific cells (eg A1:D23). The problem with this is that the area will be different everytime, so can someone please tell me how to do this? cdb |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I enter formula sum(range+range)*0.15 sumif(range=3) | Excel Discussion (Misc queries) | |||
Excel Addin:Setting the range to the Excel.Range object range prop | Excel Worksheet Functions | |||
Range Question / error 1004: method Range of object Worksheet has failed | Excel Programming | |||
Range.Find returns cell outside of range when range set to single cell | Excel Programming | |||
how to? set my range= my UDF argument (range vs. value in range) [advanced?] | Excel Programming |