Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CDB CDB is offline
external usenet poster
 
Posts: 4
Default Setting a variable print area

I am trying to write a macro that will set a print area within a sheet. I have tried to record a macro to set it to a selection using shift, control and the arrow keys (as in how you highlight a range of cells), but when I set the print area it sets it to the actual cells, so if the selection changes, the print area won't

Is there any way of doing this, bearing in mind that the selection needed to print will change each time?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Setting a variable print area

Hi
you may post your existing code :-)

--
Regards
Frank Kabel
Frankfurt, Germany


cdb wrote:
I am trying to write a macro that will set a print area within a
sheet. I have tried to record a macro to set it to a selection using
shift, control and the arrow keys (as in how you highlight a range of
cells), but when I set the print area it sets it to the actual cells,
so if the selection changes, the print area won't!

Is there any way of doing this, bearing in mind that the selection
needed to print will change each time?


  #3   Report Post  
Posted to microsoft.public.excel.programming
CDB CDB is offline
external usenet poster
 
Posts: 4
Default Setting a variable print area

Below is a copy of what I have so far

Sub PrintDailyList(

Range("A1:A2").Selec
Range(Selection, Selection.End(xlToRight)).Selec
Range(Selection, Selection.End(xlDown)).Selec
Range(Selection, Selection.End(xlDown)).Selec
ActiveSheet.PageSetup.PrintArea = "$A$1:$D$250
With ActiveSheet.PageSetu
.LeftHeader = "
.CenterHeader = "
.RightHeader = "
.LeftFooter = "
.CenterFooter = "
.RightFooter = "
.LeftMargin = Application.InchesToPoints(0.75
.RightMargin = Application.InchesToPoints(0.75
.TopMargin = Application.InchesToPoints(1
.BottomMargin = Application.InchesToPoints(1
.HeaderMargin = Application.InchesToPoints(0.5
.FooterMargin = Application.InchesToPoints(0.5
.PrintHeadings = Fals
.PrintGridlines = Fals
.PrintComments = xlPrintNoComment
.PrintQuality = 60
.CenterHorizontally = Fals
.CenterVertically = Fals
.Orientation = xlPortrai
.Draft = Fals
.PaperSize = xlPaperA
.FirstPageNumber = xlAutomati
.Order = xlDownThenOve
.BlackAndWhite = Fals
.Zoom = 10
End Wit
'ActiveWindow.SelectedSheets.PrintPrevie
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=Tru

----- Frank Kabel wrote: ----

H
you may post your existing code :-

-
Regard
Frank Kabe
Frankfurt, German


cdb wrote
I am trying to write a macro that will set a print area within
sheet. I have tried to record a macro to set it to a selection usin
shift, control and the arrow keys (as in how you highlight a range o
cells), but when I set the print area it sets it to the actual cells
so if the selection changes, the print area won't
Is there any way of doing this, bearing in mind that the selectio

needed to print will change each time



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Setting a variable print area

Hi
try the following to always print your current selection:

Sub PrintDailyList()
dim rng as range
set rng = selection
With ActiveSheet.PageSetup
.PrintArea = rng.address
end with
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
end sub


--
Regards
Frank Kabel
Frankfurt, Germany


cdb wrote:
Below is a copy of what I have so far:

Sub PrintDailyList()

Range("A1:A2").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$D$250"
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
End With
'ActiveWindow.SelectedSheets.PrintPreview
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

----- Frank Kabel wrote: -----

Hi
you may post your existing code :-)

--
Regards
Frank Kabel
Frankfurt, Germany


cdb wrote:
I am trying to write a macro that will set a print area within

a sheet. I have tried to record a macro to set it to a
selection using shift, control and the arrow keys (as in how
you highlight a range of cells), but when I set the print area
it sets it to the actual cells, so if the selection changes,
the print area won't! Is there any way of doing this, bearing
in mind that the selection needed to print will change each
time?


  #5   Report Post  
Posted to microsoft.public.excel.programming
CDB CDB is offline
external usenet poster
 
Posts: 4
Default Setting a variable print area

Cheers, I'll give that a go

----- Frank Kabel wrote: ----

H
try the following to always print your current selection

Sub PrintDailyList(
dim rng as rang
set rng = selectio
With ActiveSheet.PageSetu
.PrintArea = rng.addres
end wit
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=Tru
end su


-
Regard
Frank Kabe
Frankfurt, German


cdb wrote
Below is a copy of what I have so far
Sub PrintDailyList(
Range("A1:A2").Selec

Range(Selection, Selection.End(xlToRight)).Selec
Range(Selection, Selection.End(xlDown)).Selec
Range(Selection, Selection.End(xlDown)).Selec
ActiveSheet.PageSetup.PrintArea = "$A$1:$D$250
With ActiveSheet.PageSetu
.LeftHeader = "
.CenterHeader = "
.RightHeader = "
.LeftFooter = "
.CenterFooter = "
.RightFooter = "
.LeftMargin = Application.InchesToPoints(0.75
.RightMargin = Application.InchesToPoints(0.75
.TopMargin = Application.InchesToPoints(1
.BottomMargin = Application.InchesToPoints(1
.HeaderMargin = Application.InchesToPoints(0.5
.FooterMargin = Application.InchesToPoints(0.5
.PrintHeadings = Fals
.PrintGridlines = Fals
.PrintComments = xlPrintNoComment
.PrintQuality = 60
.CenterHorizontally = Fals
.CenterVertically = Fals
.Orientation = xlPortrai
.Draft = Fals
.PaperSize = xlPaperA
.FirstPageNumber = xlAutomati
.Order = xlDownThenOve
.BlackAndWhite = Fals
.Zoom = 10
End Wit
'ActiveWindow.SelectedSheets.PrintPrevie
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=Tru
----- Frank Kabel wrote: ----
H

you may post your existing code :-
-

Regard
Frank Kabe
Frankfurt, German
cdb wrote

I am trying to write a macro that will set a print area withi

a sheet. I have tried to record a macro to set it to
selection using shift, control and the arrow keys (as in ho
you highlight a range of cells), but when I set the print are
it sets it to the actual cells, so if the selection changes
the print area won't! Is there any way of doing this, bearin
in mind that the selection needed to print will change eac
time



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Print Area Setting RozBuds Excel Discussion (Misc queries) 3 February 19th 10 09:41 PM
Setting The Print-Area ? Robert11[_3_] New Users to Excel 2 May 31st 09 03:24 PM
Charts - Setting Data Area as a Variable JohnG Charts and Charting in Excel 1 April 28th 09 09:58 AM
Setting print area richzip Excel Discussion (Misc queries) 1 April 27th 08 08:10 AM
Setting print area Don Guillett[_4_] Excel Programming 0 September 4th 03 02:14 PM


All times are GMT +1. The time now is 03:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"