Code Get Slow Down When Trying To Print The Worksheet

Aug 18, 2009

I have a some code that we use in our office that works ok on my pc. When others in the office try to use the macro the year gets changed to 19 instead of 09. The only problem I have is that the code seems to slow down when it is trying to print the worksheet out. Can the code be shortened up/cleaned up. We are looking for gridlines with inside /outside lines, landscape and left/right margins of .25

Sub IC_Delays()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Workbooks.Add
Windows("Delays List.xls").Activate
Range("F15:N" & Cells(Rows.Count, "F").End(xlUp).Row).Copy
Windows("Book4").Activate
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats
Range("A1:I" & Cells(Rows.Count, "A").End(xlUp).Row).Select.........

View 9 Replies


ADVERTISEMENT

Copy Chart & Print Very Slow

Sep 12, 2007

I have created a code for printing specific charts on a "constant" page.

First of all the page is the same every time. It contains the same graph's (although with various data each time) and the same placement.

So when i make the page with graphs i also add a button with an attached macro.

This macro then shows an Userform where the user can decide which graph he would like to printout. I wan't specific headers and footers on the page, so the only thing i could make work is by copying the chart, and then place it in a new Chartsheet, then setting the header and footer and printing it out in the end. The code looks as follows:

Application. ScreenUpdating = False
On Error Resume Next
total = bruger + Varm + aar + varig 'the sub is called from another sub, so these are giving a value on beforehand
If bruger = 1 Then
'bruge pagesetup uden for chart object for at lave header og footer
Worksheets(sag).ChartObjects(1).Copy
Worksheets(sag).Paste
End If

Now everything works just fine, except it is really long time about doing this.

By testing i found out that the copying a chart takes alot of time in vba-code? Why is that? If i do it manually I don't have to wait for anything.

This is just a question of optimizing the code... Because i can't understand why it takes so long time with the VBA code!

View 3 Replies View Related

Print Preview Display Of Range Very Slow

Jun 10, 2008

I have only one macro created in my excel workbook which is printing rows between two rows that their references are given.

To print-preview the results only takes 2 minutes, although it is only one page because I don't have much data in the spreadsheet yet. Also, to print it takes another minute.

How can the macro run and display results in less time?

View 7 Replies View Related

Slow Running Code

Nov 6, 2008

My code runs so slow! The sheet only has 233 rows and 6 of them are not in the loop.

View 6 Replies View Related

Very Slow Small Vba Code

Mar 27, 2009

Very slow small vba code. I have the following

View 2 Replies View Related

Slow Code Execution

May 9, 2007

I have the following piece of
Sub Summarise_Variations()

Dim myRange As Range
Dim Write_Cell As Long

With Application

.Calculation = xlCalculationManual
.StatusBar = "Please wait - Summarising variations..."

End With

It happily goes through a list and sums multiple records. It might not be the most efficient or best way to do it but it works and when I run it on a couple of stand alone sheets it takes a couple of seconds to process if that.

Unfortunately when I run it as part of the overall application that I've developed it takes ages to run, i.e. more like ten minutes.

The spreadsheet has a few graphs and about 250 sumproduct and array formula live in it but all other formula on other sheets are created and then paste valued as part of other VBA routines. As you can see I've also turned calculation off as the procedure runs so don't understand why it is suddenly taking so long.

View 9 Replies View Related

Slow Inefficient Code

Aug 4, 2008

way the code below can be made more efficient? Basically, I drop down a combobox, and based on the value i select, it populates a lot of textboxes etc based on the listindex.....

Private Sub ComboBox3_Click()
On Error Resume Next
With Me.ComboBox3
If .ListIndex = -1 Then Exit Sub
Label23.Caption = Sheets("overview").Cells(.ListIndex + 2, "c").Value
Label24.Caption = Sheets("overview").Cells(.ListIndex + 2, "b").Value
Label38.Caption = Sheets("overview").Cells(.ListIndex + 2, "d").Value
TextBox1.Text = Sheets("overview").Cells(.ListIndex + 2, "e").Value
TextBox2.Text = Sheets("overview").Cells(.ListIndex + 2, "f").Value
TextBox3.Text = Sheets("overview").Cells(.ListIndex + 2, "g").Value

It takes about 10 seconds every time i choose another project

View 9 Replies View Related

Stepping Thru Code Very Slow

Mar 8, 2007

I do those things, I set every object = nothing... I even moved them up to right after I use the object. When I open the workbook, my process's shows excel at 38000K. my first go of running code, stepping thru is great... I watch my process and see that I get up to 78000K... I then exit my code, properly... and the process goes only down to about 50000K. If I run it a 2nd time excel process show almost a 100000k and stepping thru is slow, slow motion... a 3rd time and I am at 120000k. I am setting everything to nothing and can't figure it out... I have done bigger projects with more forms, recordsets, collections and never have had this problem.

View 2 Replies View Related

Slow Code For Hiding Rows

Sep 15, 2009

I have some code which looks for the word "Out" in column "L" and hides the row if it finds it. This is running from row 24 to 160 and takes about a minute to run. I've tried two different solutions, neither really quicker than the other.

View 3 Replies View Related

Why Is My Code So SLOW, Anyway To Make It Faster

May 3, 2009

I am only looping it through about 4 thousand records, looking for match and dups and moving it over to the other sheet, so why is my code running so slow?

I have run other programs where the records are in 40 thousand and it doesn't take as long as it is right now. Is there a way to make code run faster?

View 9 Replies View Related

Finding Sets Code Slow To Run

Aug 23, 2006

If you open the file sets.xls, you will see that I have listed 5 sets of 10 numbers.
A21:J21
A22:J22
A23:J23
A24:J24
A25:J25

These sets are such that all 10 numbers matches with sets of 20 numbers listed vertically in the range K1:S20 atleast twice (T21:T25 -twice)

I know there are 50+ sets like these and I have listed just 5 of them.

How can I search the other sets?

I have uploaded a zip file which has an excel file. Run the module "DoIt" and you will get all 50+ sets like these.

The problem is that the module takes 42 minutes on my Celeron 800 Mhz 256 MB SDRAM. I want to reduce this time.

View 4 Replies View Related

Excel 2007 :: Content Shown On Worksheet Different Than Print Preview And Print?

Jul 17, 2014

Since upgrading to Windows 2007 (I was already using Excel 2007) I am having issues with the content in the cells on the worksheet not appearing the same on Print Preview and when I print. On the worksheet the cell show to be at the best fit both horizontally and vertically. When I look at the contents under print preview, the contents are squashed from the top and cut off from the left. This happens whether I have the format in Top or Central align and is even worse if I use Bottom align. It is also somewhat worse if I have thickened boarders.

I am using TrueType Fonts.

View 8 Replies View Related

Copy/Paste Code Running Very Slow

Apr 4, 2009

The code opens a varying workbook with the same format as the source workbook and copies specific columns into the source workbook.

It is currently taking about 20seconds to run.

The worksheets are protected and have merged cells hence the call TestMe line.

View 13 Replies View Related

Calculation Code For Calculator Runs Slow

Oct 1, 2006

I am making a small push button calculator to enter data into a textbox on a userform in an add-in file and this works fairly slowly. I am trying to concatenate a list of numbers in a textbox that simulates a calculator screen when entering numbers.

Private Sub CommandButton6_Click()
Dim Val
Val = "6"
Dim valand As Range
Set valand = ThisWorkbook.Worksheets("Stageing").Range("K65536").End(xlUp).Offset(1, 0)
valand = Val
Dim A As Range, B, C, d, E, F, G, H, I, J
Set A = ThisWorkbook.Worksheets("Stageing").Range("K2")
Set B = A.Offset(1, 0)
Set C = B.Offset(1, 0)
Set d = C.Offset(1, 0)
Set E = d.Offset(1, 0)
Set F = E.Offset(1, 0)
Set G = F.Offset(1, 0)
Set H = G.Offset(1, 0)
Set I = H.Offset(1, 0)
Set J = I.Offset(1, 0)
TextBox1.Value = A & B & C & d & E & F & G & H & I
End Sub

View 4 Replies View Related

Optimize Slow Conditional Formatting Code

Jan 23, 2008

I am having a little trouble with this code, which runs in my simple but efective ressource overview. It loops through a rather large range and assigns interior colour to the cells based on certain criteria. On my stationary machine (Excel 2003) it takes approximately 15-30 seconds to run the code which is acceptable. On my laptop (Excel 2007) it takes 5+ minutes which is unacceptable. Is there a workaround so as to optimize the speed? Further, when I run this workbook on Excel 2007, even entering an integer in the sheet takes 3-4 seconds, and no code is running! In my first version I used a Change_Event to colour cells on the fly but this was slow and prevented multible cell editing as well as pasting values into the appropriate range.

Public Sub Farvelade()
Dim icolor, Navn As Integer
Dim TargetRow, LastRow, Previous As Long
Dim Target As Range
MsgBox "Det kan tage 15-30 sekunder at opdatere ressourcekalenderen"
Range("A5").Activate
Range("A5"). CurrentRegion.Select
'Set range
ActiveCell.Offset(Selection.Rows.Count, 0).Activate
LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row.....................

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

Optimize Slow Code And Avoid Copy To Clipboard?

Oct 7, 2013

this code to minimize it and avoid copy to clipboard.

VB:
Sub SapOutputRun()
Application.EnableEvents = False
Application.ScreenUpdating = False

[Code].....

View 2 Replies View Related

Opening Text File Makes The Code Slow

Feb 19, 2012

I am using the below to open a text file and copy the used range to my working workbook. The opening of the file makes the code slow and and also it may be bcoz i am trying to paste 11800 lines of data from one file to another.

Also i can see the flickering of the screen when the files are open. How to make the code faster and more efficient.

Code:
Sub readSimFile()
Application.ScreenUpdating = False
'//code//
Application.Calculation = xlCalculationManual

[Code] ......

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

Speed-up Slow Macro Code: Entries In Column 73 - 85 Will Be Copied From WorkbookRust To The Other Workbook If The Numer In Column 5 Is The Same

Mar 25, 2008

my existing macro, as the run takes to much time to complete. (at least 20min) I've already tried several loops, but no one worked for me. Following situation: There are two excel files, entries in column 73 - 85 will be copied from WorkbookRust to the other workbook if the numer in column 5 is the same. Not every cell within this columns contains data, so the macro should automatically jump to the last entry in each of the above mentioned columns, instead of predefine the range as you see in the code below. After the data is copied to the other workbook, it will be filtered acc. to Sub FilterMain and then copied back to WorkbookRust. As already said, the whole thing works, just to lame.

Sub Allmacros()
Dim WorkbookRust As String
WorkbookRust = ActiveWorkbook.Name
ChDir "C:Documents and Settings vogtMy DocumentsRüstplausch"
Workbooks.Open Filename:= _
"C:Documents and Settings vogtMy DocumentsRüstplauschCH_Revenue_2008.xls"
Sheets("Main_Overview").Select
Windows(WorkbookRust).Activate
Application.run ActiveWorkbook.Name & "!UpdateEntries"
Application.run ActiveWorkbook.Name & "!FilterMain"
'not ask to overwrite existing file
Application.DisplayAlerts = False
Workbooks("CH_Revenue_2008.xls").Save
Workbooks("CH_Revenue_2008.xls").Close
End Sub

Sub UpdateEntries()......................

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

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

Print VBA Code In Color?

Jan 13, 2012

Is there a way to Print VBA code in color, like how it appears on the screen?

View 1 Replies View Related

Possible To Have VB Code To Print A File?

Feb 13, 2013

I have this invoice spreasheet and I would like to when I excecute a macro to print, I would also like to use a PDFwritter to automaticly save/print the pdf file to a location and to ad the invoice number to the name like.

INV"current invoice here".

Bellow is the code I currently have. I am pretty sure this was done as I have some invoices saved but now it doesn't work.

Code:
Sub Check_Info()
If Range("AR1") = Empty Then
MsgBox "No Customer selected!", vbInformation, "Customer..."
Range("AR1").Select

[Code] ........

View 1 Replies View Related

Code To Print Sheet

Nov 27, 2007

I have 7 digit values in Col B12: down. I have sheets with names that match any one of these values. Is it possible for a macro to print all sheets in my workbook whose name matches one of the values in Col B cells 12:down??

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

Print Loop Code

May 7, 2008

I have a print code that I want to run on a loop. In column A Sheet UPSLabels, I have record numbers 1 through 94.

I have a vlookup in "C1" of another sheet that looks at the record number in "B1" and pulls in the correct information from UPSLabels based off the matchin record number in column A. I would like my code to print, update the number in "B1" by 1, and keep printing the records until it reaches 94.

I've probably supplied too much information, but the point is, I need the loop to run until "B1" reaches 94.

Sub print_loop()

Dim cnt As Range
Set cnt = Range("L1")

ActiveWindow.SelectedSheets.PrintOut Copies:=cnt, Collate:=True
Range("b1") = Range("b1") + 1

End Sub

View 9 Replies View Related

Print Preview Code

May 17, 2008

I have some code that Im trying to get to look at the sheets in my workbook and then based on if there is data in a cell and/or cells then select that sheet. Heres what I got so far thats not working. I get an error of Next without for.

Code: ...

View 9 Replies View Related

Set Print Area Through Code

Oct 24, 2008

I am having trouble setting print area on rows that can vary from 100 to 6000 rows. This code works good except that the print area cuts off the last row of data every time. "AreaBegin"=row 6 and "AreaEnd" = to last row after a set number of rows have been inserted based on a counter.

Basically how do I get this code to capture the last row for print area?

Sub SetArea()
ActiveSheet.PageSetup.PrintArea = Range("AreaBegin", Range("AreaEnd").End(xlUp)).Address

View 9 Replies View Related

Print Area VB Code

Jan 19, 2009

I wish the print area to be set based on the number entered into cell "D58". My code so far is:

Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim NumPages As Range
Set NumPages = Range("D48")
Worksheets("Sheet6").PageSetup.PrintArea = Worksheets("Sheet6").Range(0, 0).Resize(NumPages * 21, 47)
End Sub

View 9 Replies View Related







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