Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 328
Default Script to Print Range of Cells

Hi all -

I have the default print area already set for a certain space. I need to
write a script for a 2nd print area. Here is what I have so far...but am at
a loss as to have it show up correctly in print preview.

Any Help is Greatly Appreciated!

Private Sub
Application.ScreenUpdating = False
ActiveSheet.Range("GG2500:GM2745").AutoFilter Field:=1, Criterial:="<"
Range("GG2500:GM2745").Select
Application.PrintPreview

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 328
Default Script to Print Range of Cells

I have tried this, and am closer, but it shows the print preview within the
excel sheet, and gives me no options. I have to hit esc to get out.


Private Sub CommandButton4_Click()
Application.ScreenUpdating = False
ActiveSheet.Range("SpecialOrderForm").AutoFilter Field:=1, Criteria1:="<"
Range("GG2500:GM2745").Select
Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "gg").End(xlUp).Row
.Range("gg2500:gm2745").PrintOut preview:=True
End With
Range("SpecialOrderForm").Select

End Sub


"Lisa" wrote:

Hi all -

I have the default print area already set for a certain space. I need to
write a script for a 2nd print area. Here is what I have so far...but am at
a loss as to have it show up correctly in print preview.

Any Help is Greatly Appreciated!

Private Sub
Application.ScreenUpdating = False
ActiveSheet.Range("GG2500:GM2745").AutoFilter Field:=1, Criterial:="<"
Range("GG2500:GM2745").Select
Application.PrintPreview

End Sub


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Script to Print Range of Cells

What options are you expecting to see?

Not everything that is available via File|Page Setup is available in print
preview.

Option Explicit
Private Sub CommandButton4_Click()
Dim LastRow As Long

Application.ScreenUpdating = False

ActiveSheet.Range("SpecialOrderForm").AutoFilter Field:=1, Criteria1:="<"

With ActiveSheet
LastRow = .Cells(.Rows.Count, "gg").End(xlUp).Row
.Range("gg2500:gm" & LastRow).PrintOut preview:=True
End With

Application.ScreenUpdating = True

End Sub

You may want to drop the .screenupdating lines to see if that helps. I didn't
notice a difference a difference when I did that, though.

Lisa wrote:

I have tried this, and am closer, but it shows the print preview within the
excel sheet, and gives me no options. I have to hit esc to get out.

Private Sub CommandButton4_Click()
Application.ScreenUpdating = False
ActiveSheet.Range("SpecialOrderForm").AutoFilter Field:=1, Criteria1:="<"
Range("GG2500:GM2745").Select
Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "gg").End(xlUp).Row
.Range("gg2500:gm2745").PrintOut preview:=True
End With
Range("SpecialOrderForm").Select

End Sub

"Lisa" wrote:

Hi all -

I have the default print area already set for a certain space. I need to
write a script for a 2nd print area. Here is what I have so far...but am at
a loss as to have it show up correctly in print preview.

Any Help is Greatly Appreciated!

Private Sub
Application.ScreenUpdating = False
ActiveSheet.Range("GG2500:GM2745").AutoFilter Field:=1, Criterial:="<"
Range("GG2500:GM2745").Select
Application.PrintPreview

End Sub



--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 328
Default Script to Print Range of Cells

When I run this, it shows a print preview, however it does not even allow me
to print it. I can zoom in and out, but nothing else. I have to hit esc to
get out.

"Dave Peterson" wrote:

What options are you expecting to see?

Not everything that is available via File|Page Setup is available in print
preview.

Option Explicit
Private Sub CommandButton4_Click()
Dim LastRow As Long

Application.ScreenUpdating = False

ActiveSheet.Range("SpecialOrderForm").AutoFilter Field:=1, Criteria1:="<"

With ActiveSheet
LastRow = .Cells(.Rows.Count, "gg").End(xlUp).Row
.Range("gg2500:gm" & LastRow).PrintOut preview:=True
End With

Application.ScreenUpdating = True

End Sub

You may want to drop the .screenupdating lines to see if that helps. I didn't
notice a difference a difference when I did that, though.

Lisa wrote:

I have tried this, and am closer, but it shows the print preview within the
excel sheet, and gives me no options. I have to hit esc to get out.

Private Sub CommandButton4_Click()
Application.ScreenUpdating = False
ActiveSheet.Range("SpecialOrderForm").AutoFilter Field:=1, Criteria1:="<"
Range("GG2500:GM2745").Select
Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "gg").End(xlUp).Row
.Range("gg2500:gm2745").PrintOut preview:=True
End With
Range("SpecialOrderForm").Select

End Sub

"Lisa" wrote:

Hi all -

I have the default print area already set for a certain space. I need to
write a script for a 2nd print area. Here is what I have so far...but am at
a loss as to have it show up correctly in print preview.

Any Help is Greatly Appreciated!

Private Sub
Application.ScreenUpdating = False
ActiveSheet.Range("GG2500:GM2745").AutoFilter Field:=1, Criterial:="<"
Range("GG2500:GM2745").Select
Application.PrintPreview

End Sub



--

Dave Peterson

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
How to get in a vbs script the sum of values of a Excel cells in a certain range? Claudia d'Amato Excel Discussion (Misc queries) 2 June 28th 08 12:02 AM
Print Named Cells highlights web link to Excel range ExcelMonkey Excel Discussion (Misc queries) 1 June 12th 08 11:46 PM
Dynamic Print Range with cells containing formulas ! LP Excel Discussion (Misc queries) 1 March 13th 08 07:23 PM
NOT Printing certain cells within the print range Daniel R Excel Discussion (Misc queries) 1 April 20th 07 12:18 AM
Macro script for setting Print Area JB2010 Excel Discussion (Misc queries) 3 January 12th 06 06:05 PM


All times are GMT +1. The time now is 01:18 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"