Slow When Running Macros
Mar 21, 2008I have a simple Macro. I assigned to a Form button.
when i click that button systems takes lots of time to complete the macro.
left down task bar it say calcuating cells and load from 1% to 100% ...
I have a simple Macro. I assigned to a Form button.
when i click that button systems takes lots of time to complete the macro.
left down task bar it say calcuating cells and load from 1% to 100% ...
I have inherited support for a suite of Excel 2003 spreadsheets with complicated macros which run fine on XP. Having been tasked to test them on Windows 7 with Office 2010, I have not converted them as they are run by several sites globally who may not upgrade to Office 2010 at the same time. Hence they run in compatibility mode which in general is fine.
However, certain macros are veeeery slow and to the user would look like the app has hung. In debug I have found that the macro takes 10 minutes plus whenever it hits any of the following code:
Code:
With Application
.Calculation = xlAutomatic
.MaxChange = 0.001
End With
ActiveWorkBook.PrecisionAsDisplayed = False
It goes slow on each of the three 'lines' so it seems that it is actually doing an auto calc each time!
Is there some configuration I can do to prevent this? Setting auto calc to Manual didn't work and anyway I loose things, like data validation, when I save it in Excel 2010.
I have a workbook with macros Ive created that have been running just fine for 2 years now. Ive upgraded to a top of the line new Dell D830 dual core laptop with 2gb ram and installed excel 2003 (same excel as always). Certain macros that used to take a second or two to run on a celeron dell now take 3min's! Ive stepped through the code in debug mode and found that its hanging up in simple areas like "Columns("A:A").Select" and "Selection.ClearContents". We have 16 older laptops running these exact codes just fine all day long and the 2 new fast computers with core 2 duo processors are hanging up constantly in the same places in code. Ive gone through and made sure all the "option" settings are identical in excel. Is there some system setting That I'm missing or possibly an excel setting That I may have overlooked?
View 2 Replies View RelatedBelow is the entire code that I am using. It is a simple routine which checks whether a part has started its release process or not, based upon dates. The code works and does what I want.
The problem that I have is that it is very slow, for example it takes 35 seconds to go through 530 lines items. In my (limeted) experiance, based on other VBA doodlings this slow.
My code runs so slow! The sheet only has 233 rows and 6 of them are not in the loop.
View 6 Replies View RelatedI have the following macro in a worksheet...and it is running very slow. There are other macros in the worksheet and they all run very well. Any ideas by looking at this code why it would be so slow in running?
View 7 Replies View RelatedI have quite a large workbook, which runs very, very slowly when I'm on a certain sheet.
Scrolling seems to lag, and there is a long delay between me clicking a cell and it becoming active.
The sheet contains a number of web queries, and a number of cells which refernce other cells, both in the same worksheet, and other worksheets.
I have a macro that isn't very complex but it is running very slow, does anyone know any tricks on how to speed it up?
I have an excel sheet with about 3,000 products listed; there are 26 items of data listed against each.
I've been using Data Filters to manipulate the info, but my worksheet has suddenly started running incredibly slowly - up to 7 minutes to implement a simple filter selection.
There was no problem until I made a couple of changes last week:
1. Adding a simple pivot table
2. Using an Index column plus some linked formulae to extract a list of suppliers from the product list.
I assumed that it may be the INDEX and related formulae or the pivot table that were causing the Data Filters to run slow, so I deleted them, but to no effect. I've even gone so far as to copy the raw data into a new sheet, but it's still running incredibly slowly when I try to filter. I am convinced that the problem is related to some hidden legacy of the table or functions, as it only started once I'd added these, but I don't know if this is plausible in reality and if so how to get rid of it.
i have a simple question regarding vba code involving opening/eleboration/closing of different excel workbooks' format. I saw that with xls/xlsx the macro works with relatively high speed, but it is very slow when it comes to xlsm file. Is there an explanation? Does a command which enhance speed for xlsm file exist?
View 8 Replies View RelatedI have built an Application in Excel that is used by a userbase of 50+ people. Now, as standard, they are only able to access the document read only. The application writes data to an ".mdb" but the user cannot change the application directly istself.
Now, we've had the problem over the last few days that the program is running slowly when it is trying to write data back to the ".mdb" file.
I believe that it could be because connection to the sever that our application is running slowly (or the server is too highly trafficed) but our server team are telling me there is nothing wrong with the server and it's running slowly because there are too many people in one Excel application/
I use the Application.ScreenUpdating = False all the time. Any there any other things like this which speed up macros?
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.
i have the following problem: as a Workbook_BeforePrint statement i wrote a macro in which i recalculate the print area of 2 tables in Sheet1 and Sheet2. The table autogenerates new lines through another macro and therefore i need to set the area because i cannot know from the start how big will be the table (how many lines it will have). I know only how many columns it will have (from cell B2 (or Sheet1.Cells(2,2)) to column 13, on Sheet1 and 5 on Sheet2).
As i said, before Print (or PrintPreview) excel triggers this Workbook_BeforePrint macro. In this macro i count the lines on a column which is the Current Nr. column, until cell is empty (=""). The macro works perfect. Here is the macro:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
setprint
End Sub
Sub setprint() .....
I have written some very basic code to format a report in excel. When I run the code it take a very long time to execute and I receive the following error message at the foot of the page:
Cell (press esc to cancel)
Annoyingly I have had this error before and found the solution on the web but can't remember where. If memory serves my right I deleted some temp files from a specific location on my hard drive?
I have two macros. Macros 1 opens another excel file, counts the number of rows it has, inserts that number of rows into the master file and then copies the data over. Key code as follows (x3 for 3 worksheets)...
For k = 1 To numrows
Selection.EntireRow.Insert
Next k
Macros 2 'cleans' the appended data by systematically going through each row, checking if certain cells have data, and if not deletes the rows. Key code as follows (x3 for 3 worksheets)...
For l = lastrow To 12 Step -1
If WorksheetFunction.CountA(Range("B" & l & ":C" & l)) = 0 Then
Rows(l & ":" & l).Select
Selection.Delete Shift:=xlUp
edelrows = edelrows + 1
End If
Next l
Here's the weirdness. macros 1 runs fairly quick the first time out (few seconds). Macros 2 takes about 2 minutes to run (which I'm fine with). However, when I run macros 1 AFTER running Macros 2, Macros 1 goes from taking a few seconds to a few minutes.
I have a list of hyperlinks in excel with check boxes next to each, does anyone know how I can do a macro that will run another macro if the check box is checked and ignore the macro if it isnt checked???
View 3 Replies View RelatedWhen I send a workbook with macros to some of my users, they either can not open the workbook due to there being macros or they have to enable them each time the workbook is opened. I know there is a way to correct this, but I don't know how to look this up in help so I am coming to my trusted friends on Excel Forum. I would also like to know what this is called as I slightly remember that there is a name for this.
View 5 Replies View RelatedI currently use an Excel program (with macros) that run weather forecast data. It is compatible with versions XP, 2003, 2007 and 2010. However, I am trying to figure out if I can run it on a Mac. My plan is to run windows on my Mac through Parellels or VMWare Fusion.
Here is a link to the Excel Program: TX Tornado Forecast Worksheet
I have a macro created that at the mo is assigned to a button. But I would like the macro to run as soon as the spreadsheet is opened.
View 9 Replies View RelatedI usually run it on a different server while I work on another available server. However, if I am in Excel on a different server working, I cannot copy and paste in Excel (if I try to copy & paste, I end up pasting data from the macro). This makes sense since the macro is copying & pasting but is there any way around this? I purposely didn't past the code since it's huge but it has a lot of "cells.copy, activesheet.paste, etc".
View 9 Replies View RelatedExcel 2003
I have three macros:
Sub Concat()
ActiveCell.FormulaR1C1 = "=IF(RC[-1] > 1,CONCATENATE(""*"",RC[-1],""*""),"""")"
End Sub
Sub InsertLocation()
ActiveCell.FormulaR1C1 = "=IF(RC[-2] > 1, R[2]C[2],"""")"
I need To have them excecute automatically once data Is enter into a cell In column A:
I 've attempted onEvent configurations starting with -
Sub FillScanSheet()
ActiveCell.EntireColumn.Select
If ActiveCell > 1 Then
Application.Run Concat
Application.Run InsertLocation
Application.Run Dupes
End If
However I keep getting a circular reference error --
I want to run a recorded macro on the whole workbook at once, not just on the active worksheet.
View 3 Replies View RelatedI have to run several different types of macros depending on the folders. each folder contains several excel files. so what i want to do is if a folder has a certain name run a certain macro, Here is the code:
VB:
Sub Macro1() '//Change the path to the main folder, accordingly
Call RecursiveFolders("C:Path")
End Sub
[Code]....
then call macro 2 end what syntax code should go there?
Our department receives weekly and fortnighly updated workbooks from a number of different departments. Each workbook contains 10s of worksheets. Our department analyzes the data and generates reports from those worksheets.
I have developed a few macros to automate the report generation for making the computing of my colleagues easier.
Now, the problem is that all the macros are developed behind individual sheets and some modules. For this reason, my colleagues have to copy each updated sheet and paste over the older ones individually, each and every time. It is really quite time-consuming task - deleting older data from all the worksheets and then copying fresh data on each of them, one by one.
They want to make their life easier by just replacing the entire workbooks with the new ones and still want the macros functioning, as usual.
My concern is how I can put all the code in a separate workbook and how to reference data from the other workbook.
I have been writing VBA code in Excel for about 4 years, but I am self-taught, so I only know what I have had to learn. Recently, I learned that I could run a macro from a cell formula. I created several hundred cells (on multiple worksheets) that include calls to various macros. I only want to run these when I know they need to be updated, not every time I change a cell value.
I turn on Design Mode and try to modify my worksheet (adding or removing columns, rearranging stuff) and some macro(s), somewhere(?) execute every time. This can sometimes take 15-20 seconds for everything to update.
Did I hit some magic key sequence, somewhere? How is it that some of my macros, somewhere are running with Design Mode enabled (and turning it OFF, by the way)?
Whenever I share a workbook, I experience problems running macros that are problem-free otherwise. I’ve read the help menu about restrictions of using shared workbooks, but I did not run across anything that might explain this behavior. I’ve experimented with a few spreadsheets and I run across this problem in all cases. Can anyone help with an explanation or past experience? I’m assuming that by sharing a workbook, the workbook is automatically protected for both windows and structure. If this is what is causing the problem, is there code I can use to still allow my macros to run trouble free in a shared workbook?
View 9 Replies View RelatedI have made a vba program in excel 2003 that opens a worksheet using Workbooks.Open, and copies all the worksheets out into the program etc. The worksheets that I am opening have macros that automatically execute when the worksheet is opened (opening up some forms ). These macros are running when I open the file using VBA. How can I prevent this from happening. The automatically executed code in the workbook being opened is located in "this workbook" and can be seen below.
Private Sub Workbook_Open()
Dim CfileName As String
'Check Config sheet for template state
If Config.Cells(10, 3) = 1 Then
CustomizeDirInfo.Show
End If
If Config.Cells(10, 3) = 2 Then
GetConfData
GetGrpData
StdFileGen.Show
Else
Exit Sub
End If
End Sub
Here is a sample of code I am having problems with:
Sub CheckBox1_Click()
Range("Make") = Range("Make1").Value
Range("Model") = Range("Model1").Value
Application.Run ("EnterPrice")
Aplication.Run ("Unit Selection")
CheckBox1.Value = True
End Sub
I am having problems with the named ranges "Make" and "Model" which are on another sheet and with runninh the "EnterPrice" and "Unit Selection" Macros which are in Module1, I get the error message "Method 'Range' of object '_Worksheet' class failed"
I am copying web data into Excel and need a creative way to run a couple formatting macros on the data. I’m looking for the best way to initiate the macros. I cannot use command buttons because they’ll get deleting as a result of the line “DrawingObjects.Delete”.
I’d like to use a Useform with a couple buttons but am not sure how to have it automatically display when needed and hidden when not needed. I also prefer not using toolbars button unless they will only be displayed in that workbook and not any others.