VBA - Change Calculation Settings Of Workbook To Speed Up Macro
Sep 29, 2011
I have a range of cells ( C2, C5, C8:N1007, P8:P1007 ....) on a worksheet that I want to be able to clear the contents of through a macro - worksheet is entitled Database
I have 3 additional worksheets all of which have summary information on and some of the formulas are huge.
I've inserted a module and produced this code;
Sub ClearContents()
Application.Calculation = xlCalculationManual
Range("C2, C5, C8:N1007, P8:P1007, ....").ClearContents
Application.Calculation = xlCalculationAutomatic
End Sub
Because of all the 3 summary page formulas the code is taking a few seconds to run.
I'm new to VBA and just wondered whether I could switch the calculation setting for the entire workbook onto manual at the beginning of the code and then switch it back to automatic at the end of the code? Think this might speed things up.
View 5 Replies
ADVERTISEMENT
Sep 24, 2008
I am having a big problem with recalculating cells after running a macro. The macro runs at a great speed, but once the calculation is switched back to automatic, the cells are not calculating fast enough. I waited for 4 minutes and it still had not moved past 0%. The worksheet has approximately 9000 rows out to IG columns. 85% of the cells contain an if-then formula.
View 9 Replies
View Related
Aug 6, 2008
Is there anyway to change the security settings in Excel 2007 using VB macros? I have tried to record the macro as I change the settings but nothings is recorded.
Basically I have two workbooks, and I want to run one of the macros within workbook 1 from workbook 2. This is straight forward, however why I try to run it, excel says that the macros are disabled in the other workbook, but I know they are not, they are all enabled (bottom option)
I was hoping to find some way of fooling Excel into thinking the macros were enabled by changing the security settings (actually keeping them the same, but making excel think that i've changed them) before I try to the macro from the other sheet. I don't know if i've explained myself very well here, I hope I have, if not let me know and i'll try to go into more detail.
View 2 Replies
View Related
Mar 24, 2009
I have a rather large spreadsheet that takes a very long time to calculate once the new data is added. One of the many things I need to do is look to see if a unique value in range 1 is also in range 2. If it is, return some data (vlookup), if it's not, then I want a "0", not #NA. My question is, which of these two methods will result in a faster calculation (if at all):
Option 1: Do it in one step
=IF(ISNA(VLOOKUP($A3,LY,3,FALSE)),0,VLOOKUP($A3,LY,3,FALSE))
Or option 2: Do it in two steps:
Column N formula:
=VLOOKUP($A3,LY,3,FALSE)
Column N+1 formula:
=IF(ISNA(Column N value),0,=column N value)
I have many columns of data using formulas in option 1, so if I have coded this badly that could be my problem...
View 9 Replies
View Related
May 1, 2009
I have 40000 rows filling with data from column a to g, autofilter is alway on on said columns , the problem is that when I select any column to filter data as per my query , it takes long time to display result and sometimes it hangs with the msg xyz workbook is not responding.
View 9 Replies
View Related
Jan 17, 2007
I have two spreadsheets 1 of which gathers data on individuals for a daily basis for the duration of 1 month via a database query. The other sources this data (not via a lookup) for 20 staff members of staff and details this in a report. The report allows staff members names to change and automatically update their information from the previous sheet.
My problem is that even though the file size is 694kb when asked to update the sheet takes an age to load. Is there anything I can do with my sheet?
View 9 Replies
View Related
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
Dec 16, 2008
how do i change the default settings in excel, for example when i open excel it shows numbers on both rows and columns and i want it to show letters on the colunms. i know how to change the r1c1 reference style but how do i get it to stay the way i want?
View 4 Replies
View Related
Jan 2, 2007
How can I change the default settings I get with a new Excel document?
What I want is that when I create a new Excel document, all cells should have Comic Sans MS font, Bold & size 10, with a particular horizontal and vertical alignment etc.
I am not able to do these changes using settings in Option menu.
View 6 Replies
View Related
Feb 25, 2009
I am trying to change data vailidation settings on Sheet1 based on a state name provided on a separate worksheet (Sheet2). The below code is part of a macro that is assigned to a button on Sheet2. The issue is when the state name changes on Sheet2 and the button is pushed to initiate the macro to run, the state validation does not change on Sheet1.
View 2 Replies
View Related
Oct 9, 2011
Is there any way to change the settings in excel 2007, to give me the original color palate from 2003? I want to use the old colors because I don't like the new ones.
View 2 Replies
View Related
Aug 3, 2012
I have a big table with lots of columns for which I want a pivot to sum the data in the columns. Most likely because there are lot of blanks in the data Excel automatic makes a count of the data when I drag it into the pivot table. Now I have to change for each column one by one the Value field settings from count to sum. Is there a way to change the Value field settings for multiple columns at once from count to sum? If not can I somehow change the settings of the pivot table so default the Value field settings will be sum when I drag it into the pivot table?
View 4 Replies
View Related
May 19, 2008
The following line of VBA code executes properly if machine settings are US English, but throws a "Run-time error '1004': Application-defined or object-defined error" ? ...
View 9 Replies
View Related
Apr 8, 2008
I generate several reports, all saved as seperate files, with the same page settings (margins, headers, footers, etc.). Is there any way to copy these page settings from one file to another so that I don't have to enter the settings seperately for each file?
View 13 Replies
View Related
Aug 19, 2013
how to speed up a shared excel worksheet?
View 4 Replies
View Related
Aug 4, 2008
I only want to change some Visual Basic Editor (VBE) font settings on the active workbook, but whenever I do so within the Editor tab of the Options dialog it changes the VBE font settings for all workbooks.
Is it possible to change just the active workbook VBE font settings or do these settings reside in some *.ini file that once changed, globally changes the setting(s).
View 3 Replies
View Related
Apr 16, 2009
I have a workbook with many lookups, sumproducts, dynamic named ranges and cse formulas. How do I determine what is causing my workbook to be slow? Are there more efficient formula types that I can use?
Sample Formulas: ...
View 9 Replies
View Related
Jun 17, 2009
an event macro to change the font colour of a cell whose value changes as a result of a calculation.
View 9 Replies
View Related
Mar 10, 2014
I have a large file of data and the data looks like this repetitively, however, there are also useless data. But I figure out that the repeat data looks the same compare to the useless data. I need to extract the data that I only need. Is there a way to set a macro to search for a String from the beginning of the excel file, when the string is found, it will keep the 2 rows above and 56 row below it, then loop.
Here is an example of it:
A1 USELESS DATA
A2 USELESS DATA
A3 USELESS DATA
A4 USELESS DATA
A5 GOOD DATA
[Code] ....
The macro will start from A1 then go down till find STRING, then will keep 2 row above it which is A5+56 row below it which is A63.
Then continue at A64, then find STRING at A66 and do the same which is copy A64 (2 row above)+till A122 (which is 56 row below), then continue.
Since A123 to A155 does have any STRING, they will all be deleted..
View 3 Replies
View Related
Jan 14, 2010
I tried to use the code that allows macro to run even when the sheet is protected.
View 3 Replies
View Related
Apr 1, 2008
I need a code to change the Macro security settings of the computer where the file is opened to enable macros.
View 9 Replies
View Related
Jul 2, 2009
I am having trouble disabling the "Preview" button when calling Application.Dialogs(xldialogprint) in XL2003. I have an xlSheetVeryHidden worksheet containing a form which is made visible programatically when the user wishes to print a copy (code below). I want the user to be able to have access to the functionality of the xlDialogPrint dialog (i.e. select desired print destination, number of copies, pages per sheet etc.) but I also want to prevent them modifying the page setup of the protected worksheet by initiating a preview from the print dialog.
Private Sub btnPrintReturnForm_Click()
wbkRUSC.Unprotect sysPass 'unprotect workbook to enable changes to sheet visibility
' (sysPass is project constant string containing password)
shtStaffForm.Visible = xlSheetVisible 'make staff form visible
shtCalc.Visible = xlSheetVeryHidden 'hide main calculator in case user gets smart and hits..............................
View 5 Replies
View Related
Nov 4, 2008
The macro clears specific columns in a row when you click anywhere on the row and then hit the command button. It clears the first range and 2nd range in 2 distinct steps, and takes up to 3 seconds.
View 5 Replies
View Related
Sep 4, 2009
I have this analyze that is runned by a macro in one workbook, and it starts a analyzing-process in another workbook. The data is picked up in the no2 book, and returned to the first book. It is analyzing lots of workbooks, sometimes up to 1000 workbooks, it means that no2 workbook gets a new name and then saved.
I have once heard that the process could be way faster if the workbooks where the analyzes is processed through not were saved, and I actually dont need the books as long as I got the data into my first workbook.
But Im not sure what in the macro that makes it save the no2 workbook, but I would really like to speed up this process. As it is now I have to start the analyze before I go to bed, and the hopefully it's done when I wake up next morning.
View 9 Replies
View Related
Mar 2, 2010
I wrote a macro that works fine, although it runs extremely slowly as if plodding along through all of the cells one at a time. I'm sure the computer is faster than that, so I would like it to chug through more quickly.
I am using some syntax that could be optimized ....
View 9 Replies
View Related
Dec 14, 2006
I'm trying to determine the speed of a macro. I searched and have had no luck. recently with some help I reduced my macro speed from minutes to seconds and I was wondering is there code out there that I can record the speed of an existing macro.
View 5 Replies
View Related
Jun 27, 2009
I have a workbook, 'MyWb.xls' and a sheet with buttons to which I attach some sheet macros. When I assign a macro to a button I pick the appropriate reference, e.g. Sheet2.MyMacro, and this gets recorded by default as MyWb.xls!Sheet2.MyMacro
When I create a new single sheet workbook with the instruction ActiveSheet.Copy, I end up with a new workbook, say 'Book2' along with the buttons as expected. However the macros attached to the buttons still refer to the MyWB.xls file and not the new 'Book2.xls'. As part of the process of creating the new book I've tried redefining the macro with the instruction
View 4 Replies
View Related
Oct 12, 2010
I have an existing macro that takes my sheet and puts it in body of email.
how do i add to it to change the entire worksheet's font?
Code:
Function RangetoHTML(rng As Range)
Dim fso As Object
Dim ts As Object
Dim sTempFile As String
Dim objWB As Workbook
Dim i As Long
Dim iLastRow As Long
sTempFile = Environ$("temp") & "/" & Format(Now, "dd-mm-yy h-mm-ss") & ".htm"
[code]....
View 4 Replies
View Related
Jul 4, 2012
I am dealing with data sets from various instruments that have different sample rates. I am deleting data points I don't need from some of the sets with higher sample rates so that all the data is on the same time scale.
The macro I have is super simple, but incredibly slow. I'm simply deleting every other cell down a column.
VB:
Sub OATcondense()
Application.ScreenUpdating = False
Do While ActiveCell <> ""
ActiveCell.Offset(1, 0).Delete Shift:=xlUp
ActiveCell.Offset(1, 0).Select
Loop
Application.ScreenUpdating = True
End Sub
View 9 Replies
View Related
Sep 12, 2009
Does anyone know a more efficient way to run this code?
View 7 Replies
View Related