Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ADK ADK is offline
external usenet poster
 
Posts: 89
Default Print macro help

macro beginner


I have the following set to a command button to print. So far the macro sets
the print area perfectly the way I want it. I just need to know what is
missing after the print area is defined to actually send it to the printer

Private Sub CommandButton1_Click()
Worksheets("PDSR").Activate
Set c = Worksheets("PDSR").Columns("Y"). _
Find("0", LookIn:=xlValues)
If Not c Is Nothing Then
Worksheets("PDSR").Range(Cells(1, 1), Cells(c.Row, 12)).Select
ActiveSheet.PageSetup.PrintArea = Selection.Address
End If
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Print macro help

On Jul 3, 8:49 am, "ADK" wrote:
macro beginner

I have the following set to a command button to print. So far the macro sets
the print area perfectly the way I want it. I just need to know what is
missing after the print area is defined to actually send it to the printer

Private Sub CommandButton1_Click()
Worksheets("PDSR").Activate
Set c = Worksheets("PDSR").Columns("Y"). _
Find("0", LookIn:=xlValues)
If Not c Is Nothing Then
Worksheets("PDSR").Range(Cells(1, 1), Cells(c.Row, 12)).Select
ActiveSheet.PageSetup.PrintArea = Selection.Address
End If
End Sub



A good way to find out what the macro needs to do is to go through the
steps manually while recording a macro. In this case, you'll be able
to see what the command for sending the range to the printer will be.

  #3   Report Post  
Posted to microsoft.public.excel.programming
ADK ADK is offline
external usenet poster
 
Posts: 89
Default Print macro help

thanks

"jayray" wrote in message
ups.com...
On Jul 3, 8:49 am, "ADK" wrote:
macro beginner

I have the following set to a command button to print. So far the macro
sets
the print area perfectly the way I want it. I just need to know what is
missing after the print area is defined to actually send it to the
printer

Private Sub CommandButton1_Click()
Worksheets("PDSR").Activate
Set c = Worksheets("PDSR").Columns("Y"). _
Find("0", LookIn:=xlValues)
If Not c Is Nothing Then
Worksheets("PDSR").Range(Cells(1, 1), Cells(c.Row, 12)).Select
ActiveSheet.PageSetup.PrintArea = Selection.Address
End If
End Sub



A good way to find out what the macro needs to do is to go through the
steps manually while recording a macro. In this case, you'll be able
to see what the command for sending the range to the printer will be.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Print macro help

This will do it from anywhere in the workbook, withOUT selections. Pay
attention to the . s in the with statement.

Sub printrng()
With Sheets("PDSR")
lr = .Columns("y").Find(0).row
..Range(Cells(1, 1), Cells(lr, 12)).Printout 'Preview
End With
End Sub

--
Don Guillett Excel MVP
SalesAid Software

"ADK" wrote in message
...
macro beginner


I have the following set to a command button to print. So far the macro
sets the print area perfectly the way I want it. I just need to know what
is missing after the print area is defined to actually send it to the
printer

Private Sub CommandButton1_Click()
Worksheets("PDSR").Activate
Set c = Worksheets("PDSR").Columns("Y"). _
Find("0", LookIn:=xlValues)
If Not c Is Nothing Then
Worksheets("PDSR").Range(Cells(1, 1), Cells(c.Row, 12)).Select
ActiveSheet.PageSetup.PrintArea = Selection.Address
End If
End Sub


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
Macro to hide rows with a certain cell empty then set print area and print tahrah Excel Programming 12 January 9th 07 03:47 AM
Pivot Table macro to set print area and print details of drill down data Steve Haskins Excel Discussion (Misc queries) 2 December 28th 05 04:59 PM
Macro to open print window and set to print entire workbook retseort Excel Discussion (Misc queries) 1 October 27th 05 11:00 PM
Create a print macro that would automatically select print area? wastedwings Excel Worksheet Functions 7 August 22nd 05 10:36 PM
Need Help w/ Print Macro to Print All Visible Sheets (including Charts) in a Workbook will Excel Programming 3 September 23rd 04 08:05 PM


All times are GMT +1. The time now is 08:21 AM.

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

About Us

"It's about Microsoft Excel"