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


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

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

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

If-Then Test Not Working To Control Print Jobs Being Sent

Sep 17, 2007

I'm trying to print individualized reports from my Excel gradebook for only those students whose grades are below 70%. I thought an If, Then structure could do that, but the code I've come up with keeps printing reports for ALL students regardless of their grade.

totalgradeindreport refers to a cell in the gradebook where the student's total grade is displayed as a percentage. The value is actually a decimal number (I think), so I have tried to build a test for the If-then statement

If totalgradeindreport * 100 < Criterion Then

to control printing. But I am obviously doing something wrong.

Here is the
Sub DandFreports()

Criterion = InputBox("Print reports for all students whose grade falls below what percentage?", "Info", "70")

Test = Criterion / 100

Count = InputBox("Please enter the highest possible student number.")

View 9 Replies View Related

VBA Print Preview And Control Toolbox Tools

Dec 9, 2008

I have a spreadsheet with check boxes and a combo box that are set to display in print preview as well as print. I have set up a Print Preview button on this spreadsheet, as well. When you click the Print Preview button and then click close on the preview window and return to the spreadsheet, the control toolbox tools appear out of place and are greatly magnified. Scrolling the screen down and then back makes them appear correctly once again.

I have seen this on this spreadsheet on three different computers. Does anyone have a clue what is going on?

Note, clicking the print preview button on the standard toolbar does not provide the same artifact. It works correctly.

Or for the cheap fix, what is the VB script to move the cursor to a different cell and then return back?

View 9 Replies View Related

Print Worksheet With Checked CheckBox Control

Sep 22, 2006

I am creating a main worksheet (Legend) in which information will be entered and then populate to other areas (worksheets) within the workbook. I would like to create a print macro - that will run and print all the worksheets that we have selected on the "legend" page. These worksheets would have been selected by ticking a check box.

My question is how to associate a check box to a worksheet? For example - the second worksheet is named " Schedule A" 3rd "Schedule B" and so on.

- The check boxes will be name schedule A, Schedule B and so on.
- I would like to associate (link) the checkbox Schedule A with the Worksheet of the same name. Then when this checkbox is selected, and the print macro runs it will print the worksheets that are selected.

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

Macro To Print Sheets With Value In Cell A1 But Print Dynamic Ranges On Certain Sheet

Sep 24, 2013

I've found some code which works to print certain pages with value in cell A1 but I need to print dynamic ranges on some of the sheets as they will have filters on so the rows ranges will be different each time.

So far this is what I have but the dynamic range part is not working:

VB:
Sub Print_All_Worksheets_With_Value_In_A1()
Dim Sh As Worksheet
Dim Arr() As String
Dim N As Integer

[Code] ....

View 3 Replies View Related

Stop Print Macro Firing Before Print Event

Oct 18, 2006

I have a "submit" button macro which user would click after he has finished his input. This macro would update a reference number on the worksheet named "orange" and then print out this worksheet.

My purpose is "orange" is printed out with a reference number.

Below is the 1st code.....

View 9 Replies View Related

Option To Print - Use Print Macro

Dec 30, 2008

I have a few macros that run in a sheet. After the macros are finnished I would like to present to the user a msgbox that asks if they would like to print. if "Yes" is selected, the print macro runs. If "No" is pressed then nothing happens.

View 3 Replies View Related

Disable Print But Allow Print From Macro

Jun 11, 2007

I have found a macro which disables all print features in excel. I have rwo other codes to print. When I put this macro, It also disables the print from the other macro. How can I use this code so that normal print features will be disabled but if someone takes the print from the macros, Print will be allowed. The code which disables the print is given below:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If PrtOK Then
Cancel = False
Else
MsgBox "Can't print from here!"
Cancel = True
End If
End Sub

View 9 Replies View Related

Userform To Control Macro Features. Macro = Search For File Type

Jan 26, 2009

I have a macro that I found somewhere on the net to look within a folder and list all the files of a certain file extension.

The macro to do this is in the attached example and is called 'Get_File_Names_Within_Dir_ext'.

I have created a basic userform outline, 'UF1' for the user to define:
Select File Extension
Select Folder to Search
Destination Sheet

I just don't have any idea how to sync the two.

If you type 'exe' into 'TB1_File_Extension' of 'UF1' the macro should search for '*.exe' files within the specified folder.

The search folder 'RefEdit1' box should open a windows explorer box (or some such) so that the user can select the directory in which to search for the previously specified file extension.

'TB2_Destination_Sheet' is a text box for the user to type the sheet within the workbook in which to list the files found within the specified directory.

'CB1_Find_Files' should activate the macro to find any files for the specified criteria.

There is also a Button 'Find File Types' in Sheet1 of the file which should activate the userform 'UF1'.

View 14 Replies View Related

Spreadsheet Control With Range

Jan 16, 2010

Hi all im having a tough time trying to figure out a way to select a range (which will be the entire row )based on a condition that will be data selected from a combobox and display that range in a userform with spreadsheet contol 9

what i have so far is a worksheet with all the data.
i have a combobox on a userform that is prefilled with data from a specific column

every thing is working except when i select the entire row how do i change that to a range that i can use in the spreadsheet control 9 that is added to the userform.

View 11 Replies View Related

Control The Sum Range With A Cell

Sep 12, 2007

I would like to define the range of cells in the sum with a number in another cell. Say I want to sum the past 10 years, I would like the sum definition to be controlled by another cell that includes the number 10.

If I want B1 to be the sum of A1:A10, B2 to be the sum of A2:A11, etc., I would like to be able to control the range of the sum with say, C1, which in this case would contain the number 10.

This would allow me to easily change the range of data I am summing: if I changed C2 to 15, B2 would give me the sum of A1:A15 for example.

View 9 Replies View Related

Get Range Specified In Refedit Control

Sep 7, 2007

I have built a user form that amongst it's other functions displays the results from three cells on one worksheet.

The values in these cells need to be pasted in three cells on a different worksheet (cells are selected by user using a "RefEdit" field on the form.

The VBA help files offer a single example of the paste special method (I've proven I can paste to the celss but of course that pastes the formula rather than the value!) that shows it operating on a single worksheet as follows:

With Worksheets("Sheet1")
.Range("C1:C5").Copy
.Range("D1:D5").PasteSpecial _
Operation:=xlPasteSpecialOperationAdd
End With

So, simple question...

How can I use the Paste Special method to paste the values of the cells in cells specified by the user?

View 5 Replies View Related

Subscript Out Of Range :: Control Sheet

Sep 4, 2009

I have a workbook with 20 sheets, including a control sheet 'Validation Table'. By setting the required Background/Font in a cell named hdrDefault on sheet VT, I want to click a button on VT to invoke a macro to visit each sheet and set the named Header range, hdrxxx, to the same Background/Font. Originally had the code in a Private Sub linked to a button event, but this can't break out of the worksheet so have moved the Sub into a Module, and calling from the click event:

Event:

View 3 Replies View Related

File Access Control Using Range

Jun 29, 2012

I have sheet where I need to restrict access to a select group of individuals. I have a formula in a select case statement that runs from the workbook_open event and have hard coded the names of the individuals who can access the file. If they are not on the list, they are prompted for a password. This works OK, but I have sheet that is hidden and want to maintain the list of users there and update the code to loop through the values in a named range. I have a snippet of the current code below.

Code:
Select Case function_name
Case Is = "user1"
Run "enable_access_code"
Case Is = "user2"
Run "enable_access_code"
Case Is = "user3"
Run "enable_access_code"
Case Else
' User not authorized or opened while not on company network
' Prompt for project password
form_Password.Show
End Select

View 2 Replies View Related

Delete Range Name (control Character?)

Dec 6, 2006

I have a defined range in my workbook which I have not been able to delete (I think it got there through some malware because I didn't create it!)

The main annoyance is that the name refers to another workbook (to which I don't have access) and to a non-existent range therein (resulting in a #REF! error) - so I get the unwanted Update Links message each time I open the workbook. I have created my own workbook with the same name as the workbook referred to by the name, hoping that I may gain some level of control over this gremlin, but to no avail.

The name is "Flow" immediately followed by a thin-lined empty square (like the ANSI character 042 formatted using Wingdings2 font). It could be a line-feed character.

Whatever it is, I have not been able to delete this range name - either directly through the Insert / Name / Define / Delete commands or by using VBA. Using the menu commands I can select the name, edit it (even add a valid cell reference to the workbook name), and click Add - but that just adds a new name "Flow" without the control character and the original name remains! The original name also remains if I select the name and click Delete.

View 6 Replies View Related

Set Range Variable To RefEdit Control

Dec 3, 2007

I'm trying to set up a userform with a refEdit box that allows the user to select a cell range. I then need to assign that cell range to a range variable so the macro can use it. I'm having a problem reconciling the assigned string variable that refEdit returns and the range variable that I need.

So what I'm trying to say is that I can assign the range fine through the Userform, and I can see through the debugging screen that mySampleVariable (dim as a variant) holds a range value of 'Access Dump'!$A$8 (the correct range), but when I try to

Dim myRange As Range
Set myRange = mySampleVariable

The code bugs out because it apparently can't assign a string value to a range variable.

View 4 Replies View Related

UserForm Control To Select Range

Aug 8, 2008

I want a control to select a range in a userform I'm creating.

I wonder if we can use the same type of control the wizards use, where you click on the right and choose the range? Alternatively, what's the best option?

View 9 Replies View Related

RefEdit Control To Click On The Desired Range

Jul 8, 2009

I am using a refEdit control on a userform to get a range from the user (they use the refEdit control to click on the desired range). My problem is that the user typically has 3 or 4 different workbooks open and if one of them is maximized withing Excel, the user is unable to get to them to select the range (only the maximized workbook is displayed and usable). Is there a way around this?

View 4 Replies View Related

Userform - Date Range To Control Autofilter

Jan 10, 2012

creating 2 fields in my userform that the user can input 2 dates that would serve as the range to set the autofilter. So user inputs field1 = 11/01/2011 and then field2 = 01/31/2012.

I was previously using a month range in my userform, populating from the known months and allowing the user to select a range. Since our data is now spanning a new year, this is no longer possible as I cannot make the combobox range go from 11 - 1 (November to January)

VBA Userform - select months & Months between - Code Included

View 1 Replies View Related

Control Down With Macro

Oct 9, 2007

I record a macro that copy a portion of a tab to another, but when my data changes the destination get data one above the other. I think it is because instead of sending Control Donw it goes to the cell that I recorded the macro with.

I probably just need to send Control downkey....

View 12 Replies View Related

Assign Range Values To Control Toolbox Combo Box

Apr 3, 2009

I've built the code for a Template form for data entry of a survey. Through Control Toolbox I've created the form and used several textboxes, option buttons, checkboxes and COMBO boxes this one in turn being my trouble.
- Sheet one is called "Data" (this is the place where all inserted information is going to be stored
- Sheet two: "Variables" (here is where I keep the required values for the como boxes - inserted manually apriorely...
Question: What is the code to assing to the combo boxes in order to have the values from the sheet "Variables" of the range A1:A4 - use the comboboxq2 for referee, I'll do the others
P.S. see the code up to now:


Private Sub CommandButtonN_Click()
Dim eRow As Long
Dim ws As Worksheet
Dim inf As WorksheetFunction

Set ws = Worksheets("Data")
Set ws = Worksheets("Variables")


' Find first empty row in database survey
eRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row ................

View 9 Replies View Related

Limit Date Range In Calendar Control To 1 Year

Mar 31, 2007

How do I limit the user from being able to choose only 1 year after they pick the first date on the first command button?

Here is the code on a userform which has a Calendar Control ...

View 9 Replies View Related

Use Msgbox To Control Macro

Oct 28, 2009

the below macro choose the row number that is entered into textbox on a userform

frmUnHide

View 2 Replies View Related

Macro - Control End To Last Row And Paste To NEXT Row

Nov 9, 2013

I am venturing off on to my 2nd Macro Formula. This one is a little different than my first and I am not sure where to start, to correct the piece I am missing. I am able to create the basics, I have added the "Last Row" formulas. The piece I am missing, when I control end & "paste", it is pasting on the last row with content. I need it to paste to the row BELOW the populated content. Here is my current smaller sample of what it is doing.

Sub Macro2()
'
' Macro2 Macro

[Code].....

View 2 Replies View Related

Out Of Control Insert Row If Macro

Nov 15, 2007

I am trying to build a macro to insert a row or two rows under an existing row if a formula returns a '2' or a '3' in the first cell of the existing row. This is what I've come up with so far and the first bit works fine but when it comes to inserting the rows it just spirals out of control, inserting never-ending rows.

Private Sub Labels1_Click()

Columns("A:A").Select
Selection.Insert shift:=xlToRight
Range("A3:A2000").Formula = "=ROUNDUP((Q3/300),0)+1"

With Sheets("Sheet1")
' Test Condition 1
For Each c In Worksheets("Sheet1").Range("A3:A2000")
If c.Value = 2 Then
c.EntireRow.Select
Selection.Insert shift:=xlDown
End If
Next c

View 9 Replies View Related







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