Set Print Area From Selected Range

Jul 12, 2006

I have some code which selected a certain amount of columns depending on
whether they contain values or not. Once I have this range set and I select
it I want to set this as the print area. I am not quite sure how to do
this. for example I tried:


rngUnion.Select
ActiveSheet.PageSetup.PrintArea = ActiveCell. CurrentRegion.Address

View 9 Replies


ADVERTISEMENT

Programmable Print Area: Macro To Set The Print Area According To The Amount Of Data In A Particular Range Of Cells

Feb 25, 2009

Using Excel 2003 I am trying to write a macro to set the print area according to the amount of data in a particular range of cells. I find I can include this instruction

View 2 Replies View Related

Print 2 Selected Area (highlighted Area)?

Apr 11, 2013

How can I print 2 selected area (highlighted area). I know there is a trick to do that. Right now I can only select (highlight) one area to print, but would like to know how to print 2 or more areas at same time

View 7 Replies View Related

How To Set Fixed Print Area In Excel So Cells Within Print Area Can Still Be Modified

Feb 12, 2013

I have a workbook with multiple sheets that I need to print.

Is there a way to create a fixed print area within which you can mess around with formatting without extending or shrinking the print area?

I have tried adjusting the margins settings so that they are all the same, but this does nothing to keep a fixed print area.

View 1 Replies View Related

Set Print Area Of Dynamic Range

Dec 17, 2006

I have a sheet with a top portion like a fax cover letter.
Starting at row 17 I merged from B thru L.
This is where the user will type in a message.
The message can extend several pages long, so I merged about 100 rows same as 17.
My sheet only will extend to column N.
There may be instances where the user may leave several rows blank in between what they type.

I am looking for a way to set the print area from A1 to the last row of data and not the last row with formatting.

I have a command button the user is supposed to click when they want to print the sheet.
This is acceptable, but if there was a way around that it would be better.

Note:
I do have code in the sheet that will automatically adjust the row height in the merged cells if the data gets too wide. I do not want to upset that.

I have just recently started to learn VBA, so my knowledge of the various commands and syntax is limited.

This is what I have right now that doesn't work.

Private Sub CommandButton2_Click()
Dim LastCell, DataCells As Range
Dim LastDataRow As Integer
Set LastCell = ActiveSheet.Cells.SpecialCells(xlLastCell)
Set DataCells = ActiveSheet.Cells.SpecialCells(xlconstants)
LastDataRow = DataCells.Cells(DataCells.Cells.Count).Row
ActiveSheet.PageSetup.PrintArea = Range(ActiveSheet.Cells(1, 1), ActiveSheet.Cells(LastDataRow, LastCell.Column)).Address
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub


View 9 Replies View Related

Set A Range Based On Area Selected Using Mouse?

Oct 2, 2009

I'm trying to set a variable for a range based on the cells selected. For example, I want variable "myrange" to be set to range("A1:D14") if I click on cell A1 and drag it to D14. So far everything I've tried ends up getting the good old "1004 - Application defined or object defined error".

View 4 Replies View Related

Print Area Range Based Upon Formula

Feb 26, 2012

I am trying to dynamically set a print area based upon a formula from the contents of 2 cells. What I need is the print area range to be C1 to Ix, where x is the result of ((A2/B2)+2).

View 2 Replies View Related

Set Print Area For Range Bounded By Row & Column Header

Dec 4, 2007

I want to select a range in a spreadsheet and then set it as the print area. the last column I want to be selected is contains the text data "ABC" in row 1 and is the only column with data "ABC" in row 1. The last row I want to select contains the text data "DEF" in column 1 and is the only row in column 1 containing the data "DEF". Basically I want to select the range [A1:column("ABC")row("DEF")] and then set it as the print area.

View 2 Replies View Related

Print Previewed A Worksheet And Find A Tiny Image With A Small Portion Of The Print Area

Mar 27, 2009

I just converted from Excel 2003 to 2007 and print previewed a worksheet and find a tiny image with a small portion of the print area. When I look at the sheet in page break preview mode, I see the 8.5 x 11 sheet broken up into approx 77 smaller sheets. When I try to move the page breaks to include the whole sheet it states the change cannot be made as it will result in an image less than 10%. I have attached two images - the first shows the print preview I get, and the second show the multiple pages when I view in page break.

View 4 Replies View Related

Vb Code To Set Print Area And Print Out

Aug 24, 2007

with creating vb code that will select certain rows in a spreadsheet, set the print area to those rows and print them out, and then reset the print area back to default.
The data is all on one sheet, but is split into 5 different areas, each below the next, with the column headers at the top of each.
e.g.

header_____header_____header
data_______data_______data
data_______data_______data
data_______data_______data

header_____header_____header
data_______data_______data
data_______data_______data
data_______data_______data

and so on. At the press of a button it'll set the print area to the first section and print (the section includes the headers as well as the data). Then at the press of another button it'll set the print area to the next section. There could be any amount of rows of data in each section so it needs to cope with that.

View 9 Replies View Related

Print Only Used Area

Nov 9, 2006

I have a sheet that will be about 5 pages long if printed. To minimize wasted ink and paper, using VB I would like to be able to have it only print the portion uses (data entered) along with a section at the top and bottom. The section at the top would print on the top of the first page and the section at the bottom would print on the last page.

I know I could record a macro to select an area and print that but it would not do what I am trying to accomplish.

View 14 Replies View Related

Set Print Area VBA?

Jul 18, 2012

I have an excel sheet with lots of rows (it goes up to BAA) I would like to be able to print certain parts with a VBA

for instance if Sales is selected from a drop down (lets say A1) the macro will print

Area : C7:Z500
Scaling: fit to 1 page
Orientation: landscape
Color: Color

or if Sales next year is selected

Area : C7:D7 AA7:AZ500
Scaling: fit to 1 page
Orientation: landscape
Color: Color
etc....

View 9 Replies View Related

Print Area Always Changes -

Oct 2, 2007

I use the code below to print a portion of a sheet. My problem is that the area always changes. The $A$476 should be the first cell in that column that contains "HEA" The "536" in $F$536 is the last row that contains data. There are conditional formats all the way down to row 1,000 but not data

Private Sub CommandButton1_Click()
Dim strCurrentPrinter As String, strNetworkPrinter As String
****strNetworkPrinter = GetFullNetworkPrinterName("Adobe PDF")
****If Len(strNetworkPrinter) > 0 Then ' found the network printer
********strCurrentPrinter = Application.ActivePrinter
********' change to the network printer
********Application.ActivePrinter = strNetworkPrinter
********ActiveSheet.PageSetup.PrintArea = "$A$476:$F$536"
********ActiveSheet.PrintOut** 'print something
********' change back to the previously active printer
********Application.ActivePrinter = strCurrentPrinter
********ActiveSheet.PageSetup.PrintArea = ""
****End If
End Sub

Obviously there is a function also that finds the full network printer name, I didn't think it was important, because my issue is the print area. Everything else works fine. If you need it let me know and I will post it.

View 5 Replies View Related

Vba To Set Print Area

Feb 18, 2007

Looking for a macro that will set the print area on an accounts spreadsheet to the last non blank row, bearing in mind that all the rows contain formulas, have tried some macros but they assume the cells with formulas in them are non blank

View 4 Replies View Related

Refer To The Last Row In A Selected Area Using VBA..?

Nov 3, 2008

I'm trying to do is add a signature box (for inventory-taking accountability) directly below the pasted area after I paste it. Now, of course, the copied and pasted area could have 5 rows or it could have 15, and when I copy it from the first sheet and paste it into the second it doesn't preserve the name of the range on the second page, so what I really need to do to add the signature box directly below the last row in the pasted area is specify the location in relation to the last row in the pasted selection, but I don't know how to do that. Using ActiveCell always refers to the top-left-most cell in the selected area. So...

If I have an area selected, how do I refer to the bottom-right-most cell in that selection (in the same way that ActiveCell refers to the top-left-most cell)? Or at least the bottom row? Or, even better, the row below the bottom row?

View 2 Replies View Related

Remove Selected Area

Apr 17, 2007

I need to worked out Hours worked in a timesheet. This was the easy part, the hard part is the clause tha HR threw in, which is:

If you have worked and 8 hour day WITH 1 hr lunch then you qualify for overtime.
if you work a 8 hr day and work through your lunch (1 hour) (so equivelant to 9 hrs) you still do NOT qualify for overtime there for Overtime = 0.

This is cause some people work though their lunch to get overtime, but legally they have to have a break so we are not paying overtime for it. I have basically tried in a formula to replicate this but it works with some data and not with all. attached is an example, as you'll see the formula works in some cells, but not others.

View 2 Replies View Related

Set Print Area Using Activecell

Oct 7, 2012

Goal is to select range from active cell ( where coursos is ) to the top of that row. For some reason

ActiveSheet.PageSetup.PrintArea = Range("xey1":ActiveCell())

Does not work?

View 3 Replies View Related

VBA Code For Set Print Area

Feb 6, 2014

Making a macro that selects active cells (so anything with text in) and sets that as the print area.

Using the default builder I have:

Range("A1:AA44").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWindow.SmallScroll Down:=30
Range(Selection, Selection.End(xlUp)).Select
Range("A1:AA692").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$AH$692"

[Code]...

Can trim this code with something

Range("any containing data").Select
ActiveSheet.PageSetup.PrintArea = "selection"

View 1 Replies View Related

Print Area Keeps Expanding

Mar 29, 2014

copying a document that was made in word into Excel. I set the print area and page size but it seems I can keep adding columns. When I check the print preview it still shows the one page but it appears wider.Will it automatically create a new page if the page size limit is reached?

View 2 Replies View Related

Print Area In 2007..

Jan 22, 2009

Excel 2003 used to have a feature where the user can select and set the print area. I do not see this feature in Excel 2007. So, how dow I set the print area in Excel 2007?

View 2 Replies View Related

Dynamic Print Area

Feb 5, 2009

I can define a name to calculate the desired Print Area for a page. For example, print_area_notes: =Notes!$A$1:INDEX(Notes!$A:$Z,final_Note,5). I can then use that name when defining the Print Area via Page Setup.

The problem is it calculates the cell range immediately and substitutes that in the Print Area field. When print_area_notes changes the actual Print Area does not. Is there some formula I can enter in Print Area that will allow this value to be set dynamically? I have tried setting Print Area to =indirect("print_area_notes") but it doesn't like that. I could, but prefer not to, write a VBA function to set the Print Area but even then how do I set it to be called automatically? I'd prefer to be able to enter a formula and do it without VBA code because you then have the security issues every time the spreadsheet is opened.

View 3 Replies View Related

How To Set Print Area In Code

Jul 6, 2014

I have 2 codes that set up different "print areas". Every time i run one of the codes the print area doesn't get set unless i run the same code again. So if i run code A which will set the print area with no issues and then right afterwards i run code B then code B's print area won't get set unless i run code B a 2nd time. And if i now i run code A, the same issue happens and the print area to Code A won't get set properly unless i run the code again.

Here is part of the code that discusses the print area:

[Code] .....

View 6 Replies View Related

Setting Print Area By VBA?

Aug 19, 2014

I have looked for a way to set the print area of a worksheet through vb.

I would like it to find the last row of the worksheet and set it to be printed.

Some of the examples take it beyond the last row of data, because the the code that may be in the empty cells.

HTML Code: [URL] .....

View 2 Replies View Related

Dynamically Set Print Area?

Feb 12, 2014

I'm trying to dynamically set the print area for a given worksheet. I use the code below and it works perfectly when it's executed upon opening the tab; however, the worksheet has filters which may lengthen/shorten the required print area.

Is it possible to execute the code below when the user selects print rather than when opening the tab?

[Code] ......

View 4 Replies View Related

Variable Print Area

Nov 4, 2009

I'm using Excel 2003.

I have a spreadsheet used for costing jobs giving a detailed breakdown of parts and time. Sometimes the customer requests a copy so I'm creating a macro for my boss that prints the spreadsheet, less the hidden columns that I don't want the customer to see. This I can manage.

My question is this: Is there a way within the macro to set the print area to change to where the last cell is automatically?

Each spreadsheet is a different length dependent upon the work required and setting a larger print area to compensate would use excess paper and ink.

View 10 Replies View Related

Setting Print Area VBA?

Jul 19, 2014

I'm looking for code that would set print area when printing the output of my Macro. Print area will always be the same for all two pages. I need to display first two tables on page one, and the next two on page two. All four tables will always contain the same number of columns and rows. I'm trying to automate this process as much as possible.

View 1 Replies View Related

How To Auto Set Print Area

Jan 29, 2007

if there is a way with functions or code to automatically set the print area. I would like to have it set to start at A1 and print to column G & the first ROW with a zero value in column F.

The ROW in which the first zero value appears will be the only variable. It will
always be column G.

View 9 Replies View Related

Macro To Set Print Area

Jul 20, 2007

Is there a macro that can automatically set the print area by determining what the used range is. For example, If P96 is my last used cell, I would want a1: P96 as my print area.

View 9 Replies View Related

Using Macro To Set Print Area

Oct 11, 2007

My macro selects cells containing data - then i want the macro to set the print area to those selected cells - works fine - but the selected cells won't be the same each time i run the macro. Here's how it looks now:

Range("A1:M1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$M$76"

The next time i run the macro the selected cells won't be A1:M76 - how do i have the macro set the print area to whatever is selected?

View 9 Replies View Related

Print Area Code

May 7, 2008

I have some code to select a print area depending on wether or not there is data in a cell. The code I have so far partially works but not quite like I need it to. Here's what I have,

Sub selectprintarea()
Select Case True

Case Range("C5").Value > 0
Range("A1:M47").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$M$47"

Case Range("Q5").Value > 0
Range("A1:AA47").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$AA$47"

End Select
End Sub

It will select the print range if there is data in C5 but if there is data in C5 and Q5 it only selects the first print area. I know I need an "If - Else" or something of that nature but I cant figure that out. Also I need it to look at other worksheets not just the active one. I've tried a replacing the ActiveSheet with Worksheets (Sheet1). but that gives me an error.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved