Print Range :: Find The Last Row Used

Nov 1, 2009

I found this code on the forum, I have tried to use it but it looks for the last row in column A and then prints to that. How do I set it to find the last row used in Column C and not A

Private Sub CommandButton1_Click()

'Find the last row used - uses Column A for search
Dim r As Long
r = Range("A65536").End(xlUp).Row

'Sets Print Area
ActiveSheet.PageSetup.PrintArea = "C1:X" & r
MsgBox "Worksheet Printed"
End Sub

View 9 Replies


ADVERTISEMENT

Find Print Range And Print Invoices From 250 Tabs

Feb 24, 2014

I have a pretty large spreadsheet set up that invoices our clients. A few tabs in the front allow us to globally invoice if we did certain services for all clients and then we can also go into each tab and invoice each client for specific services performed on their property. Some invoices are two pages long and other may be up to seven pages long and anywhere in between... So that's the first issue, how do you find how many pages to print and then set the print range for each invoice.

The second issue centers around being able to print all the invoices at one time.

The spreadsheet is set up in this manner: A recap sheet we print to check off that each invoice was printed; an IIF statement to get the Excel info into QuickBooks; a template to set up each invoice's information with dates, dates services were performed,etc.; then there are five Global billing tabs where I can invoice all accounts globally or by their type of account (Saturday or Sunday open, 24/7 etc.); then we get into the tabs for each account. Each account has its own tab with an invoice loaded inside where we can itemize the services they received. Inside all these individual account tabs we have set up 'Zone' tabs where we can invoice all the clients we set up within a zone. There are about twenty of these tabs. Then at the end I have a few more tabs that aren't used any longer, there are about ten tabs there...

Is there a way I can hit Print and get all of my invoices to print out at one time versus having to go into each and every tab, set the print range, and then hit Print for all 250ish invoices?

This is the biggest complaint I have right now about the invoicing program I have set up...

View 4 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

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

Find Last Column In Print Area

Jun 18, 2007

I need to use macro to find the last column index number within the print area. My cell sizes change depending on the data entered so the last column in the print area changes. The code I want to implement involves putting a title at the top of the page and creating a border that spans the width of the page. This is what I have so far:

LastColumn = Cells.SpecialCells(xlLastCell).Column ' replace this with last column in print area

Rows("2:2").Select
Selection.Insert Shift:=xlDown
Range(Cells(1, 1), Cells(2, LastColumn)).Select
With Selection
.MergeCells = True
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With

With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With

View 7 Replies View Related

Find Data..then Copy It To Another Sheet..to Print It

Mar 19, 2007

i want user using userform to search for the wanted data then the displayed data be copy to another new sheet.. and be able to print!

hope the idea is clear!

i will attach the file in case someone wants to show me the example...

View 7 Replies View Related

Resize Print Range To Fit A 4

Oct 14, 2009

I am trying to print a range that falls just outside of a normal A4 size. Is there a way of scaling this range to fit the page. Withough changing the column sizes before printing(each column is diffrent size). Or will i need to load the column sizes into a array and resize for the print then back to original size from array.

View 2 Replies View Related

Print Range Macro

Jun 10, 2009

setting up a print range macro:

I have a sheet where:

1) column A (rows 1-54) needs to be printed with every printing
2) other columns (b-e) or (f-i) etc need to be printed out with each printing

Is it possible to setup a macro to do this as long as I know which columns need to be printed every time (will be same number of rows every time)

Basically, there is info in column A that needs to be printed every time, then I want to be able to print out a months worth of data (b-e for january) for each printout. It is essentially a calendar that I need to print up a hard copy of.

I know zero about vba and much of what I have found on the internet has only confused me more.

View 14 Replies View Related

Print If Cell Range Has Value

Sep 18, 2008

I have a excel sheet that has a range of cells (Q39 - Q49) that I required to be filled with yes or No befroe the user is able to print off the sheet.

what I thought of doing is creating a command button to print the sheet once it has checked to see if the range is filled?

Does anyone know how to disable the print functions and make the cmd button to check the cell range before printing the sheet?

View 9 Replies View Related

Macro To Print Specified Range

Oct 16, 2006

I would like to have a code that allows user to print. The print area is fixed at A1 to U50 and should be printed in 1 page. The sheet name is called "apple".

View 2 Replies View Related

Print Only Rows In A Range That Contain Data

Apr 12, 2008

Print rows in a range that contain data. There could be rows at the bottom of the range that are blank and don't need to be printed.

View 14 Replies View Related

Print Range When All Cells Are Filled

Feb 27, 2009

write this in VBA on the Workbook Level, "ThisWorkbook" : IF range (B20:B53, E20:E53, H20:H51) are all filled through user keypunched values--checks and coupon amounts.AND range (C20:C52, F20:F52, I20:I50) are equal to = " "

-- these ranges contain formula that spits out values only when there are discrepancies with the manually keypunched values above' otherwise it's equal to " ".THEN call batch02. batch02 is a macro that prints the specified batch.I have attached the filed I am working with. There are 25 batches, hopefully I can replicate the codes by just changing the ranges and the print macro.

View 4 Replies View Related

Automate A Dynamic Print Range

Jan 27, 2010

This one seems tricky to me. I have a spreadsheet which is being used to collect data. Depending on what is selected in my drop-down menus in row 8 (columns B-N) my print range needs to change. The goal is to create a button that allows the end user to select the range without having to find the end of the spreadsheet.

- I have attached a grid named “RANGE.xls” that shows the logic I’m looking to automate.

- I have also attached the data collections spreadsheet (FY10 Data Collection Tool_V0.6.xls)

The end users of this spreadsheet are very Excel naive and I’m trying to make this semi-idiot proof.

View 2 Replies View Related

Macro / Set Dynamic Print Range?

May 6, 2004

I am still having some difficulty in getting a macro to select a print range on a text file imported into excel. All the data pulls into column A which is OK. I'm trying to get my macro to highlight & select the print range by going Home, End Down, Tab right Tab right and then select whatever that highlighted range is. This range will change from file to file.

My macro reads as follows:

Sub PrintToView()
'
' PrintToView Macro
' Macro recorded 5/5/2004 by
'
'
Range("A1").Select

[code]....

View 5 Replies View Related

Print Range :: According To Text In Cell?

May 13, 2006

Is it possible to set a print range according to Text in cell? For instance I want to VBA to print A1 to P?. The range would stop depending on the data in Column B.

Column B consists of either "CON" or "CP". I want the print range to extend until the last "CON", it should stop before the "CP"

View 9 Replies View Related

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 View Related

Print Specified Range On Worksheet From Userform

Jul 26, 2006

I have a worksheet called "ComplaintData".

In this worksheet I have data in following range : "N1:V2".

N1 to V1 is headings and N2 to V2 is data transfered from listbox on userform.

I am trying to print this range via command button on my userform.

I am wondering anyone can help me with the code for selecting and printing this range when user clicks on the "Print" command button on my userform?

how I can format this print out to look different than the tabular format? I mean if possible I would like to print this in portrait, fit to one page and possibly not look like a table. (If it has to look like a table then I will have to go with landscape as the table wont fit portrait without getting too small and un-readable)

View 6 Replies View Related

Select Variable Print Range

Aug 1, 2006

I am trying to create a command button on my userform that will allow me to print all the records in the worksheet....in other words it should only print the rows with data......

*my worksheet is called "complaintData" - this is hidden and not active sheet.
*I have columns A to J with information, with heading from A1:J1.
*I want to be able to print all the rows with values in column A. (Not all the columns except "A", will have values for every record....some may be blank for some records...
*I want all the columns to fit in in one page with headings (A1:J1) being first row on every new page.....
*page setup should be landscape...

I have tried a few codes from this forum, but not sure where I have goofed up....am still trying learn VBA.....would appreciate if anyone can fix this code for me....cheers

Private Sub cmdPrint_Click()
Sheets("ComplaintData").Visible = False
Dim ws As Worksheet
Set ws = Worksheets("complaintdata")

View 6 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

Print Used Range Except Header Rows

Jan 6, 2007

i am trying to come up with some code to print many sheets in a workbook based on user clicking a button on each sheet.

I would like the code to be reusable and based on the activesheet, this way I don't need to write code specific for each sheet.

My first thought was to use something like ActiveSheet.UsedRange, but the rows may span several pages, so I'll need the header row to repeat on each page

Here's a snippet I recorded

ActiveSheet.PageSetup.PrintArea = "$A$2:$E$12"
With ActiveSheet.PageSetup
.PrintTitleRows = "$2:$2"

But I can think of a way to use UsedRange but drop out about rows 1-4 which do not need to be printed on the reports

Number of Cols varys on every sheet as well and diff start/stop cols
Ex one sheet A:G, another sheet C:T

View 9 Replies View Related

Dynamic Print Range To Fit 1 Page

Jul 20, 2007

I have a print range set up that is based on a named range that is an offset formula. The problem is that I would like to set it up as portrait instead of landscape, but if I do that the area to the right doesn't all fit on the page. The print area will always be a certain width, just different hights. I just want to be able to have the print range adjust downwards and still fit the whole area on one page wide.

View 2 Replies View Related

Automatically Change Print Range

Jan 5, 2008

I have an Excel file that I believe was a template, maybe from MS. It's a loan calculator. Anyway, whenever you change the interest rate or number of payments it somehow knows to only print those rows - even though there are formulas in many of the rows beneath the print range.

View 4 Replies View Related

Print By Date Depending Range

Jan 8, 2008

i have a excel sheet which i use to schedule my service team. Basically i have horizontally the dates ((a colum for every day of the year) and vertically the guys names (about 25 rows).

I would like to add a function so i can push a button and i automatically print the past, current and next week of my shedule on one page.

In addition it should print my usage chart which is on a different work sheet in the same file.

View 9 Replies View Related

Control Print Range Macro

Jan 11, 2008

the macro simply copies a master sheet, then re-organizes/re-sorts the raw data in the new sheet. At the end, I'm trying to set a print range to 1 page wide and inifinity pages long, figure out where the end of the fourth page is, then reset the print range to accommodate four pages. In case it matters, the macro starts with a form that allows the user to input a company ticker and name used in output.

The problem is that when I use the debugging step function (very tedious), it works perfectly. But when I run it normally, it locks up for about 30 seconds when setting the print range to 1 page wide, and cuts off the print range vertically at just over 2 pages tall. Brief explanation of a couple variables:

ColLetter is a function as follows:
Function ColLetter(ColNumber As Integer) As String
ColLetter = Left(Cells(1, ColNumber).Address(False, False), 1 - (ColNumber > 26))
End Function
ActiveSheet.PageSetup.PrintArea = "$A$1:$" & ColLetter(j + 3) & a + 7 .............................

View 2 Replies View Related

Automatically Set Print Range For Last Row Before Printing

Feb 19, 2008

I'd like to set the print range based on the last row with text in specific columns. I found a couple of macros in this forum to adapt, but neither are working. Extra rows, which only contain conditional formatting, and other excluded rows and columns still print.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim MaxRow As Long, i As Integer
MaxRow = 1
For i = 1 To 6
Cells(65536, i).End(xlUp).Select
MaxRow = Application.WorksheetFunction.Max(MaxRow, ActiveCell.Row)
Next i
ActiveSheet.PageSetup.PrintArea = "$A$2:$F$" & MaxRow
End Sub

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim LastRow As Long
LastRow = ActiveSheet.Columns("A:F"). Find(What:="*" _
, After:=[A1], SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
ActiveSheet.PageSetup.PrintArea = "$A$2:$F$" & LastRow
End Sub

View 4 Replies View Related

Identify First Cell Of Print Range

May 27, 2008

I'm looking for a way to identify the first cell of a page without using the pagebreak function: Sheet6.Range("B" & Sheet6.HPageBreaks(i).Location.Row). The reason being is for overall speed and performance as well as avoiding <out of range> errors on the last break. If I use totalPages = Sheet6.HPageBreaks.Count + 1
to determine the number of page breaks, is there a way to identify the first cell of page i in this way?

View 5 Replies View Related

Tweaking Dynamic Print Range Across 7 Sheets

Oct 26, 2008

In a school gradebook, there are 7 sheets for grading. In each sheet, student names and other info are in cols B through E, and headings are on rows 11 & 12. Grades are in cols Z11:AB..., AC11:AE..., and AO11:AQ..., where ... would be the last row of grades associated with a student.

My obstacle is that the grading cols contain formulas down to row 80, so Range(Selection, Selection.End(xlDown)).Select goes down to row 80 instead of stopping on the row of the last student's name on that sheet.

Another obstacle is that student records are on every other row (odd rows) starting on row 13. Their grades are in the same row.

View 10 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

Add Single Column To Defined Print Range

Dec 6, 2013

Currently i have a macro that prints range column A to O but i need to add column AD on the end of the O so in effect Ii would get A:O & AD. Current macro is below:

Sub PRINT_CALL_OFFS()
'
' PRINT_CALL_OFFS Macro

Sheets("DFS Result").Range("A:O").PrintOut
Sheets("CAR Result").Range("A:O").PrintOut
Sheets("ACU BOS(Z1)").Range("A:O").PrintOut
Sheets("ACU LON(Z2)").Range("A:O").PrintOut
Sheets("ACU MIDS(Z3)").Range("A:O").PrintOut
Sheets("ACU SW(Z4)").Range("A:O").PrintOut
Sheets("ACU WALES(Z5)").Range("A:O").PrintOut
Sheets("ACU SOTON EXP").Range("A:O").PrintOut

End Sub

I have tried adding & AD as follows:

Sheets("DFS Result").Range("A:O" & AD).PrintOut

However this doesn't work.

View 5 Replies View Related

Dynamic Print Range - Offset Function

Jul 19, 2014

I have a worksheet where the number of rows will change on a weekly basis and I would like to print the sheet out without having to change the print range every week.

I have tried to use the OFFSET function in the print range in print setup but once this has been entered and printed, it changes to the actual print range the OFFSET returns.

View 1 Replies View Related







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