Macro: ajust the print of a range to 1 page wide/tall

  • Thread starter Thread starter Snoopy
  • Start date Start date
S

Snoopy

Hey guys
It annoys me that I constantly have to ajust my prints to 1 page tall/
wide by using the printing tools, and put my self together in
intention to program a little piece of macro that will give me joy and
laughter back...
However - my skill are not as big as my selfconfidence, and failed -
so I have to send this discrete inquiry to the people of Excel-jungle
- full of vulnerable expectation of getting some help here.

My prosedure:
The user marks his range.
The macro prints this as ajusted 1 page print.

My effort:
ActiveSheet.PageSetup.PrintArea = "B1:N53"
With ActiveSheet.PageSetup *** bla bla bla
End With

ActiveSheet.PageSetup.PrintArea = "B1:N53"
With ActiveSheet.PageSetup *** bla bla bla
.FitToPagesWide = 1
.FitToPagesTall = 1 *** bla bla bla
End With

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

My problem.
PrintArea = "B1:N53" is constant what-so-ever

I hope the ussue is cearly presented and will be very grateful to be
helped

Regards
Snoopy
 
Snoopy, FitToPage doesn't want to work unless you explicitly set zoom to
false. Also, if you want to print the entire sheet, don't set the print
area. I also added a line to go ahead and print the sheet. HTH, James

Sub PrintToFit()
With ActiveSheet.PageSetup
.PrintArea = ""
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
ActiveSheet.PrintOut
End Sub
 
Snoopy, FitToPage doesn't want to work unless you explicitly set zoom to
false. Also, if you want to print the entire sheet, don't set the print
area. I also added a line to go ahead and print the sheet. HTH, James

Sub PrintToFit()
With ActiveSheet.PageSetup
.PrintArea = ""
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
ActiveSheet.PrintOut
End Sub













- Vis sitert tekst -

Holy Cow! You are a genius!!
Thanks a lot zone

Kindly regards
Snoopy
 
Back
Top