printing with a command button

  • Thread starter Thread starter lindickson
  • Start date Start date
L

lindickson

I want to print 20 consecutive cells using a command button on my
page.
Can someone help me?
 
Not sure exactly what you want, but this may help....

Sub Print20()
Range("A5:A24").Select
ActiveSheet.PageSetup.PrintArea = "$A$5:$A$24"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("A5").Select
End Sub

Vaya con Dios,
Chuck, CABGx3
 
We can even take that a step further, making it more generic so that what
ever cell is currently selected becomes the top cell in a range that includes
20 cells in the selected cell's column:
Sub Print20()
ActiveSheet.PageSetup.PrintArea = _
Selection.Address & ":" & Selection.Offset(19, 0).Address)
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
'and set the PrintArea back to the entire sheet
ActiveWindow.SelectedSheets.PageSetup.PrintArea = ""
End Sub


Dim whereAmI As String
whereAmI = Selection.Address
Range(Selection.Address & ":" & Selection.Offset(19, 0).Address).Select
Stop
Range(whereAmI).Select
 
We can even take that a step further, making it more generic so that what
ever cell is currently selected becomes the top cell in a range that includes
20 cells in the selected cell's column:
Sub Print20()
    ActiveSheet.PageSetup.PrintArea = _
      Selection.Address & ":" & Selection.Offset(19, 0).Address)
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
'and set the PrintArea back to the entire sheet
   ActiveWindow.SelectedSheets.PageSetup.PrintArea = ""
End Sub

  Dim whereAmI As String
  whereAmI = Selection.Address
  Range(Selection.Address & ":" & Selection.Offset(19, 0).Address).Select
  Stop
  Range(whereAmI).Select








- Show quoted text -

I will try these ideas on the week end. Thank you so much to both of
you.
Ron Binette
 
You're welcome.........holler back if you have problems.........a lot of us
are here even on the weekends <sigh>

Vaya con Dios,
Chuck, CABGx3


We can even take that a step further, making it more generic so that what
ever cell is currently selected becomes the top cell in a range that includes
20 cells in the selected cell's column:
Sub Print20()
ActiveSheet.PageSetup.PrintArea = _
Selection.Address & ":" & Selection.Offset(19, 0).Address)
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
'and set the PrintArea back to the entire sheet
ActiveWindow.SelectedSheets.PageSetup.PrintArea = ""
End Sub

Dim whereAmI As String
whereAmI = Selection.Address
Range(Selection.Address & ":" & Selection.Offset(19, 0).Address).Select
Stop
Range(whereAmI).Select








- Show quoted text -

I will try these ideas on the week end. Thank you so much to both of
you.
Ron Binette
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top