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


ADVERTISEMENT

Select Range In Worksheet Where Last Cell In Range Is Variable?

Jan 27, 2012

I am trying to write code to select a range in a worksheet where the last cell in the range is variable.

Sub DataTest()
Dim LastColumn As Integer
Dim LastRow As Long
Dim LastCell As range

[Code].....

View 8 Replies View Related

VB To Select Variable Range

Mar 24, 2012

Basically I need a bit of VB to find the last cell in column F with text in it (is it End(xlUp)??) and then apply full borders from that cell up to cell Q5. A test macro tells me the border bit is as follows, so just need defining the range.

Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0

[Code] ......

View 2 Replies View Related

Select Variable Range

Jul 10, 2007

I know how to do Range("A" & I).Select, but how about if I want columns A thru E instead?

View 7 Replies View Related

Select Range With Row Variable

Dec 11, 2007

I am doing is setting a variable called eof to the number of rows (with text) and i just want to select columns A1 - G1 and the eof range!

Dim eof As Integer
With Sheets("Coverage Count (%)")
eof = .Range("G65536").End(xlUp).Row
'crashes on the .select
.Range("A1:G1" & eof).Select
Selection.Sort Key1:=Range("G2"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With

I've done this before and I could have sworn this worked...but i must be missing something.

View 5 Replies View Related

Variable Range Select - Then Clearcontent

Jul 3, 2009

This one should be easy but I keep running into the same wall.

On every page I have single cell defined name range based on the sheet name & "_startcell"
So on sheet MfgReq I have cell A3 defined as name range "MfgReq_startcell".

I would like to the following:
.clearcontent using the "MfgReq_startcell" as the upper most left cell, all the columns to the right, and all the rows down.

on this sheet it might be 5 columns wide by 4000 row & on another sheet it might be 50 columns wide by 50000 rows.

View 9 Replies View Related

Select A Variable Range Macro

Aug 23, 2006

I have tried various syntaxes but nothing is working for me. I am using XL 2000 so it doesn't have the relative address function in the macro! So here is what I have

ActiveCell.Range("A1").Select
ActiveCell.R1C1
Range("R1C1:R1C85").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues
Application. ScreenUpdating = True
Range("A1").Select

I need to be able to select from the originating cell which will always be in "T" Col thru to "CZ" col but will be on different rows.

View 2 Replies View Related

Select Row Between Cell Range Row Determined By Variable

Jan 28, 2014

I have a row stored in the variable Found_Row3 and I want to set the variable ACRow to all colomns from A to Z of that row. Below is what I have so far...not working

[Code] .....

View 7 Replies View Related

Select/process Variable Range With Macro

Dec 15, 2006

I download some data from a commercial real estate site about properties and their owners and process it in Excel. Out of 1,000 records, maybe 20 or so will have the data end up in the wrong fields. This is an artifact of the data source the commercial site uses.

Anyway, what I need to do is to get the data back in the right fields. So, I sort the data to pull together at the top of the sheet all the records with data where it's not supposed to be. So far, so good.

Now from one data download to another the number of records which end up in the sort will be different. And, here's the problem.

I try to record a macro mimicking my selection of the range of the data that needs to be moved. Fine, no problem. And, on the same dataset it works like a charm. But as soon as I put a different dataset into the spreadsheet with a different number of records that need to be corrected the macro fails.

Apparently, this is because the macro has been defined with a certain range of cells selected in the first data set and this same range is used for subsequent datasets with different numbers of errant records.

Basically, what I'm trying to record in a macro is the Shift/Control End and Shift/control arrow commands. But they don't record as such.

View 9 Replies View Related

Select Variable Data Range For Graph

Jul 23, 2008

I need to select data from columns A, B and I for the graph. I have the below code but get an error message. Can anybody help ?

Set cellGR1 = Cells(2, 1)
Set cellGR2 = Cells(K, 2)
Set cellGR3 = Cells(2, 10)
Set cellGR4 = Cells(K, 10)

Charts.Add ....

View 9 Replies View Related

How To Select Range And Clear Based On LR Variable

Jul 28, 2008

I want to select and clear a part of a sheet.

here is what I have.

Sub clear_data()
sheets("sheet1").select
lr = activesheet.usedrange.rows.count

Here is where I get lost in translation (syntax).

I want to select starting at Bcolumn through bycolumn but the row be set with the LR from above, since the rows always change.

I could write B2:by2000, but i want to use the LR variable to define the number of rows i have.

View 9 Replies View Related

Select Range Based On Variable Cell Content

Apr 30, 2009

Based on if the value in col A contains the characters "TT" I want to select the range starting with this cell and ending at the end at the end of the row I'm using (.End(xlRight) and then merge these cells, change colors etc. And then looping this through a 'range' so that it only occurs where the values occur. I can amend various cells based on this idea, but am unable to identify the range and then merge the cells.

View 2 Replies View Related

Select Variable Range In The Middle Of Worksheet Down To The Next Blank Row

Jun 5, 2009

I want to select the variable range somewhere in the middle of the sheet from where the 2nd instance of cell named "real cost" is, down to the next blank row (select the area without the blank row), so that I could copy it to another sheet.....

View 6 Replies View Related

AUTO SELECT THE ACTIVE CELL RANGE IS VARIABLE ON MY REPORTS

Mar 23, 2009

I RECORDED THIS MACRO BUT I WILL LIKE TO MAKE TO AUTO SELECT THE ACTIVE CELL RANGE IS VARIABLE ON MY REPORTS MY CODE

Sub FORMAT_AS_A_TABLE()
ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$L$1900"), , xlYes).Name = _
"Table1"
Range("Table1[#All]").Select
ActiveSheet.ListObjects("Table1").TableStyle = "TableStyleDark5"
End Sub

View 3 Replies View Related

Excel 2010 :: How To Apply Print Titles To Print On Select Pages

Dec 10, 2012

Using Excel 2010: I have 2 rows (A4:J4 & A5:J5) selected as print titles that I would like to be printed at the top of selected pages. Currently, my document is 3 pages long, and I would like to have the print titles only applied to the first 2 pages. More data will be added in the future on pages 1&2 but the last page (whatever page number it ends up being) should not contain the selected print titles.

View 2 Replies View Related

Print Out Data That Is Variable In The Amount Of Rows To Print

Apr 15, 2009

I am trying to come up with a way to print out data that is variable in the amount of rows to print.

1. Cells C1 thru M6 is heading of report
2. Cells C7 thru M400 all have formulas and display information only when criteria in Column C in each row is met, if condition is not met it displays no informtion. (There lies my problem).

I need a way to print out only the area that information is displayed in and skip the areas that are not displayed. (Currently I have hard coded the print range using the largest report)

View 6 Replies View Related

Append Variable In Variable Select Case Method

Feb 16, 2012

I want the select case list of a ComboBox to be treated as a variable in order to shorten the code size. To clarify the problem, i post the code with what i want to do, but don't know how to do it that way.

Code:

Select Case ComboBox1.ListIndex
Case 0: y = "AT"
For j = 0 To 26
Case "j": y = sheets("name").Range("A(j)") 'Range A(j) is a string, so y as well, as seen in Case 0.
Next j
End Select

Is something like this possible?

View 3 Replies View Related

Range.select Error (SELECT METHOD OR RANGE CLASS FAILED)

Jul 23, 2008

I have this:

Private Sub CommandButton1_Click()
Worksheets("Sheet1").Activate
Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate
ActiveCell.PasteSpecial
End Sub
it errors to: SELECT METHOD OR RANGE CLASS FAILED

View 9 Replies View Related

Select A Variable Based On A Variable

Jun 18, 2009

On my userform I have 20 comment icons (imported pictures), that when clicked need to bring up an InputBox for the user to add a comment, and store that comment in a Public variable specific to that comment which will later be written to the spreadsheet.

To keep it simple, lets say I have two comment icons to click, one to add comments to the "Testing Completed?" field, and one to add to the "Sign-Off?" field.

The first comment icon is named TestCompIcon, the second is SignOffIcon, and the public variables they write to are called TestCompComment and SignOffComment respectively.

To avoid having to code the InputBox procedure for every comment icon on the userform, I was hoping that upon click, the icon would call a centralized routine that would establish the name of the variable that needs to be written based on the name of the icon comment that was clicked. Something like as follows:...............

View 9 Replies View Related

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

Only Print/select Certain Rows

Aug 19, 2008

I have a very large worksheet with many dates entered. I want to be able to run a macro that prints all the rows that has a date less that 35 days ahead in the future. all the dates are mixed up and not in any order.

Is there a way i can do this?

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

Select And Print Used Pivottable Columns?

May 21, 2014

I would like to somehow select and print the used columns in my pivot table.

I currently have a code that prints TableRange2 but this also includes blank pivot tables columns which are not in use.

View 2 Replies View Related

Use VBA And Select A Specific Print Area

Oct 3, 2008

is there a way to use VBA and select a specific print area.
i want only up to column 'z' and to select from row 'a' to the final row with data in it.

View 6 Replies View Related

Macro To Select Shape To Print Off

Jan 2, 2014

I created a shape and named it Cheque and created a macro to print the shape as follows:

ActiveSheet.Shapes("Cheque").PrintOut

But the macro is not printing!

View 4 Replies View Related

How To Select Multiple Sheets And Print Them

Apr 14, 2014

I'm trying to select multiple sheets and print them out. At this time the code is only printing out the "Work Order" sheet. I'm guessing it's something to do with the PrintOut command trying to print the active sheet and not the array?

Code:

Sheets(Array("Work Order", "Timesheet", "Communications")).Select
Sheets("Work Order").Activate
ActiveSheet.PrintOut Copies:=1, Collate:=True

I have also tried the following but it just prints out every page in the workbook.

Code:

Sheets(Array("Work Order", "Timesheet", "Communications")).Select
Sheets("Work Order").Activate
Sheets.PrintOut Copies:=1, Collate:=True

I've also tried the PIDOOMA approach with this and failed

Code:

Dim TechnicianPack As Variant
TechnicianPack = Sheets(Array("Work Order", "Timesheet", "Communications")).Select
Sheets("Work Order").Activate
TechnicianPack.PrintOut Copies:=1, Collate:=True

View 7 Replies View Related

Put Print Dialog Box Selection Into A Variable

Jan 16, 2012

Is there a way to have the print dialog box come up, make a selection, and put that selection into a variable?

Ex:

Code:

Application.Dialogs(xlDialogPrint).Show

brings up the print dialog. I need to be able to select the printer and have the selected printer put into a variable in my vba code.

I have tried Ex: w=Application.Dialogs(xlDialogPrint).Show, but all I get is w=true

The reason I need it is because I will be printing via vba code, but the printer may vary for different print jobs.

View 6 Replies View Related

Variable In Footer For Print Macro

Sep 5, 2006

This sounds like a daft question I know but I have searched the forum but not found an answer despite finding a lot about footers. How do I include a formatted variable value in my printed footer? I have a function that gives me the file creation date and I need that in the footer but formatted 8pt Arial Bold. I have no problem inserting a formatted fixed string.

View 9 Replies View Related

Macro To Select An Area, And Print Selection

Mar 15, 2009

I need a macro to select the area within the blue invoice sheet box, so everything within the blue invoice sheet box is selected , and then the selection should be printed. I will have hundreds of these invoice slips made, right below each other, i was wondering once this is done, is there an easier way to to have each invoice selected, instead of making a custom button for each sheet ( which selects just that invoice , and prints that selection ).

( Column m through v, starting at row 2 stoping at row 68, is the selection required in this example, everythign within the blue box. ).

View 13 Replies View Related

VBA To Auto Select Last Populated Print Page

Feb 19, 2014

I have a sheet that already has page breaks set at specific intervals to ensure the data is displayed in a certain way on print, I can only have whole pages. The variable is how many pages are printed on each project, which can be anything between 1 and 20 or more. I have a few columns that contain line numbers, and formulae down the entire length of the sheet, so a basic last populated cell search won't work, but the column I'd like to focus on is Col F, which only has blank/empty cells below the last used one in use. Is it possible to have a BeforePrint code find the last populated cell in Col F and simply capture which print page number it is in, and set that as the number of pages to print?

So in summary, I'd like to be able to just hit Print, and the code will automatically set the number of pages to print based on which page contains the last populated cell in Col F.

View 2 Replies View Related







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