Thread: Print
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Print

Sub Print_Pages()
Dim TotPages As Long
Dim x As Long
Dim y As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
With ActiveSheet.PageSetup
x = 1
y = Range("AH42").Value
ActiveSheet.PrintOut From:=x, To:=y
End With
End Sub


Gord Dibben MS Excel MVP

On Wed, 11 Apr 2007 11:34:02 -0700, Chey wrote:

I want to put a command button on my excel spreadsheet. I have how many
pages in a cell example in cell AH42 will say 3. How do I tell it to print
pages 1-(whatever the number in AH42) is?
Thanks
Cheyenne