Macro To Select Shape To Print Off
Jan 2, 2014I 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!
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!
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. ).
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 RelatedI am trying to select a shape in a cell and place a cell reference into the shape. I know the cell address, but do not know the shape reference. (The row that the cell and shape reside came from copying the row from another sheet and inserting it into the current sheet). I can not seem to come up with the correct code to accomplish this. Right now I have:
Cells(r + 1, 48).Select
ActiveCell.Shapes.Select
ActiveShapes.Formula = "$AW:" & r + 1
Where r+1 is the row where the line finally resides after insertion and "AW" is the column to the right of the cell where the shape resides.
I have tried to put the cell reference into the shape at the location where it is copied from but the reference is not dynamic and I can not seem to get it to be. Another issue that will arise is that the rows in the new sheet will probably be sorted and I question if the cell reference will follow the shape's new location.
I have a construction schedule that my boss wants modified. There is a pesky dot I cannot select to delete. It is on a grid line and I can only select the cells adjacent to it.
I am using 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] ....
when i run the below code i get an error 438 'object doesnt support this property or method'
View 2 Replies View RelatedI 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.....
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?
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.
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.
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
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")
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.
I've set up a short bit of code to select the print area for several pages in a workbook, but have no idea how to get the code to "activate". I tried placing a command button on a page to activate the code, but for some reason it won't see or act upon any sheets outside the sheet the command button is on. Same goes for the "event" proceudres on pages (activate, change.selection, etc).
View 9 Replies View RelatedI am making a spreadsheet file for our football offcials group to review rules.
I tried to record a macro to copy a shape and put it into the spreadsheet, but the shape does not copy.
How do I get the shape to copy into the spreadsheet?
What I want is for them to "think" what they would do and then click the macro and it will show them where the ball would be after the foul/fouls.
I posted similar yesterday. No one helped...sniff sniff (where's the crying smily)
Now verified to be occur on other machines running various versions of Office 2007...
In Excel 2007, write this simple macro and assign it to a shape:
I have to create an identical button on 20 sheets.
I have a shape creation macro but it creates in the default format.
Can I either change the default format so they are created in the way I want or code to add formatting? I need no shadow, can colour (pref with gradient fill), bevelled edges and text.
Sounds like the first option will be easiest if it works!
I am trying to write a set of code, part of which involves moving a shape around an excel spreadsheet in a square shape within a certain range. It is based on a random number generator. The shape moves a number of cells to the left/right/up/down depending on the random number (d) multiplied by 16. If the shape reaches a row or column border point, it will change direction but continue moving in the new direction until it has gone as far as was determined by the random number (*16). I have some code which works fine... to a point! The shape starts out, reaches a right hand border, changes direction to go up, reaches another border, changes again and goes left, but then when it comes to change dorection the 3rd time and go down, it fails. The direction of the shape is determined by a word in cell A1 - left/right/up/down:
Sub MoveRed()
Application. ScreenUpdating = True
Dim d As Integer
Dim i As Integer
d = Range("AZ1").Value
With ActiveSheet.Shapes("RedDot")
For i = 1 To 16 * d
Select Case Range("A1").Value
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
I have a UserForm that I want to use as a “Print Selection Page” using check boxes to make selection or multiple selections of pages to print from different spreadsheets but same work book.
View 9 Replies View RelatedI'm using the select sheets to print code from: http://j- walk.com/ss/excel/tips/tip48.htm. I need to add in another option to select whether to print the page as horizontal or landscape. I've been able to add the checkbox, but am having a hard time with the loop to process correctly. I also have the landscape changing code as well. Here is my
Option Explicit
Sub SelectSheets()
Dim i As Integer
Dim TopPos As Integer
Dim TopPos1 As Integer
Dim SheetCount As Integer
Dim PrintDlg As DialogSheet
Dim CurrentSheet As Worksheet
Dim cb As CheckBox
Application.ScreenUpdating = False
If ActiveWorkbook.ProtectStructure Then
MsgBox "Workbook is protected.", vbCritical
Exit Sub
End If
Set CurrentSheet = ActiveSheet............
I am changing command buttons over to shapes for aesthetic purposes. I went to assign a macro to call useform4 using a rectangle with the following code:
[Code] .....
It throws me some kind of file path error which makes no sense. Do I have to dim the rectangle2 for active sheet or something?
I've got a macro function which calculates the area of a polygon freeform using the 'shoelace'-methode. I would like to excute this function after i leave the shape editing mode.
For example: I have a square, freeform shape. By right-mouseclick I can edit the shape nodes. If i drag one of the nodes of the square to another position and click outside of the shape, the new shape is updated. Right, on that moment i would like to trigger my macro to recalculate the area.
Is there an event in excel to aim for, like the Worksheet.change-event or something similar?
I've got a macro that I can rund when I click on a shape. It's called "Shape_Click".
Basically, I want this macro to be automatically assigned to any shape I create, as I create it.
I know the line will be something like: [Code] ........
I have a macro that runs when I click on a shape. This macro is called "Shape_Click"
I can apply that to a shape by selecting it and manually running this macro:
[Code] .....
How do I get the subroutine to run as soon as the new shape has been selected, rather than haviong to manually run it.
Something like "Sub Worksheet_ShapeAdded" or something like that? I can't work it out.
I have map shape in my excel sheet. each country is a shapes on its own. If i Select one of the country i want to display a pop up Box. For examle if i select Americas I need it to display another box with some data and when i deselect it it should hide the box. Tried some code over here but does not work.
Sub HideShowRectangle()
With ActiveSheet.Shapes("Data1")
If ActiveSheet.Shapes("Americas").Select = "True" Then
.Visible = True
Else
.Visible = False
End If
End With
End Sub
I found in an old file that i triggered the macro by clicking a button! I would post a pic but i don't know how. How do I activate a macro by clicking a shape on the excel 2002 page?
View 7 Replies View RelatedI am making custom time sheets to suit our agriculture business - these excel sheets get sent out to the different farm managers who send back in staff times.
This code below is brilliant and works perfect for our needs. However I need to be able to emailPDF the sheets not print.How / where do I change code so the selected sheets go to Save & Send via email as a PDF instead of going straight to the default printer .( hard copy )
VB:
Option Explicit
Sub SelectSheets()
Dim i As Integer
Dim TopPos As Integer
Dim SheetCount As Integer
Dim PrintDlg As DialogSheet
[Code] .....
The below code opens up the printpreview window. This does not allow to select the correct (or change) printer it will automatic use the default printer.
Is there a way for the code to open the print window so I can change the printer and select number of copies?
Code:
Sub Print_Button()
Dim ws As Worksheet, cell As Range
Set ws = Sheets("main")
Set cell = Range("g2000").End(xlUp)
Do Until cell.Value ""
Set cell = cell.Offset(-1, 0)
Loop
ws.PageSetup.PrintArea = ("A2:" & cell.Address)
ws.PrintPreview
End Sub
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