Crashing Error/sheets Add
May 2, 2007
I have a large model, and it sometimes starts having very strange errors. The workbook sometimes becomes corrupted, giving a:
"Microsoft Excel has encounted a problem and needs to close. We are sorry for the incovenience"
"AppName: excel.exe AppVer: 10.0.6823.0 ModName: kernel32.dll
ModVer: 5.1.2600.2945 Offset: 00012a5b"
error when I try to close the spreadsheet. One of the sheets can have a lot of data (up to 10,000 x 150) and the error will also occur if I try and delete the sheet, or clear the entire sheet. Also, the model runs vba code, which at one point deletes the data sheet and adds a new sheet. However, sometimes the sheets.add functionality stop working, i.e. when the code runs the sheets.add line, nothing happens. I don't know if the errors are related.
View 3 Replies
ADVERTISEMENT
Aug 9, 2007
I have been running a simulation for about 18 hours now and just received:
Run-time error '1004':
Method 'Add' of object ' Sheets' failed
I have been creating new sheets, importing data, pulling some values from the data then deleting the respective sheet. I am using:
ActiveWorkbook.Sheets.Add after:=Sheets(Sheets.Count)
The sheet is actually being added to the workbook, seemingly before the error. I resume the code, and a new sheet is placed in the workbook and it errors again. The Debugger stops and highlights on the code above.The sheet count number was 10895 at the error, just as an indicator of how many times the simulation has performed successfully. I am hoping this is something I can fix without having to start over...
View 9 Replies
View Related
Aug 11, 2012
I made an Excel/VBA solution for a company in which userforms were created and manipulated programatically, including their code modules. They would then be deleted so next time they were created there wasn't naming errors.
They acted as data input forms which would have an input control for each column of data on the sheet.
There was one method which would create the form and then call another to add code to it's code module.
In one scenario, if the user would do data entry on one sheet and then immediately after do data entry on the same sheet using the data entry forms.
When this occurred something peculiar happened, after the method which added the code to the code module executed excel would crash. By putting a MsgBox to pop up just before the End Sub statement and having another in the calling function immediately after the procedure call. It became evident that the sub adding code to the module was not exiting correctly and causing the program to crash.
In essence the program was crashing when End Sub was executed
View 1 Replies
View Related
Apr 28, 2014
My Excel file crashes whenever I attempt to make a copy of a tab, within the same workbook, and then save. This problem only occurs with its existing naming convention. In other words, the file crashes with the name "Cash Flow Model 5 Year Plan". If I rename the file to "Copy of Cash Flow Model 5 Year Plan" then it works perfectly, with no issues copying a tab within the workbook. The file size is not too large, as this issue never occurred when the model was twice the size.
View 1 Replies
View Related
Jul 28, 2009
I've been putting together an automated spreadsheet that has external data sources to SQL. I have been having some strange problems with it between versions of Excel. Unfortunately, the company's standard is 2003 but quite a lot of the company use 2007. I have been developing this report on 2007, the server that runs the automated version of the spreadsheet runs 2003 (and cannot be upgraded beyond 2003 as it is running Server 2000!).
The template opens fine on my 2007 machine and all development work has been run on my machine including the downloading of data. The VBA script runs something like
refresh datasources ........
View 14 Replies
View Related
Nov 21, 2013
I have to send out emails to all of my staff with their new login ID's and PW's and other misc information one by one to each user. Reason being is that all ID's, PW's and other information pertains to that specific user and includes sensitive information.
I know there's a VBA script I can use to send out the emails, but the script I found online keeps crashing my Outlook and requires it to go through my personal inbox which takes 15 minutes every time.
I have the pertinent information split up into different columns/cells.
A1: email
A2: subject
A3: body (ID, PW, verbage)
A4: attachment link (if required)
A5: if I could have Outlook automatically stamp each email with my signature that'd be awesome as well.
View 4 Replies
View Related
Dec 27, 2012
I have a semi-large macro which I have been creating on and off for a few months now. The file will fundementally be used by people with little knowledge of Excel, hence I force the user down certain alleyways depending on what they have previously done with the aid of veryhidden sheets and such like.
Upon opening the file, some code is ran to hide all of the sheets in the file apart from the home page. This is a pain when I am still working on the code though, so a portion of it is commented out. When I uncomment the "on error.. - next sheetIn" so that the file runs as it would be used, the code itself works perfectly and hides all of the sheets apart from the home page. Unfortunately, I can't then view the VBA code as it instantly crashes Excel (and any other Excel file I currently have open). This happens whether I click the Visual Basic button in the Excel ribbon, whether I try and access it through the design mode on a control, pressing Alt+F11 or even opening up another spreadsheet containing code and attempting to click on the broken macro after viewing the VBA code for the working spreadsheet.
VB:
Sub workbook_open()
'stop screen flickering whilst running the code
Application.ScreenUpdating = False
[Code]....
The only way currently to get back into the code is to open the spreadsheet up with macros disabled and recomment the code, but obviously this loses the function of the code.
View 3 Replies
View Related
Sep 12, 2013
I have a report that uses external data to feed a Pivot Table.
I noticed that the data source had been turned off automatically by Excel and turned it on and added the file location to the trust centre.
I also set the data to refresh when the workbook is opened.
I saved the file and then tried to refresh the data which caused Excel to crash. Of course now I can't open the file either because when it attempts to refresh itself on opening that causes Excel to crash as well.
Addendum: I have removed the Trusted Location which has caused Excel to disable the connection again. This has solved the crash on opening but I still can't refresh the data.
View 3 Replies
View Related
Feb 14, 2014
I had this code working perfectly. However in the last 24 hours it has started freezing on me. Here is the code:
' This code will dynamically hide or unhide rows based on whether a row contains a transaction
Sub hideRows()
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
Application.DisplayAlerts = False
Sheet1.Unprotect Password:="University"
[Code] .....
I call the code into a Worksheet_Change module on a particular sheet (Sheet1). It hides rows between 11 to 1503, but if I innocently select these rows, the spreadsheet freezes on me & I have to kill Excel. I'm guessing I need to add code to counter these do nothing events?
View 1 Replies
View Related
Apr 16, 2014
I've been trying to put together a function in excel which will make it simpler and a bit clearer to produce the coefficients of trend lines in cells. I want to produce an excel function like SLOPE and INTERCEPT but for exponential, power and logarithmic trendlines. For example, I can produce the coefficients for an exponential trendline like this:
Code:
=SLOPE(LN(K2:K11);J2:J11)
=EXP(INTERCEPT(LN(K2:K11);J2:J11))
Ideally, I want to be able to do so without the need to convert the terms with LN function, and be able to replace it with a new function that deals directly with an X Range and a Y range
I've produced the following code:
Code:
Function PowerSlope(YRange As Range, XRange As Range)
For Loops = 1 To YRange.Count
YRange.Value2(Loops, 1) = Log(YRange.Value2(Loops, 1))
Next Loops
PowerSlope = Application.WorksheetFunction.Slope(YRange, XRange)
End Function
However, this causes Excel to crash and shut down (not the macro itself, but the entire program). I can't even get the function to run to a break point in the first line before the crash happens. I'm able to remove the FOR ... NEXT loop and use the function to directly return the result of the linear slope, so I'm confident the issue is not in that part of the code.
View 4 Replies
View Related
Jun 4, 2008
The spreadsheet is essentially a VBA GUI that validates information entered before writing it to a sheet in the workbook. There is a button on the first sheet that opens the GUI, and when the workbook is first used the GUI opens and runs fine. After adding a few rows using the GUI, saving the workbook, and then reopening it, attempting to open the GUI by clicking on the button will cause Excel to crash (and no errors are given). To compound the problem, it is not possible to find the issue by using the debugger, as the GUI runs fine as soon as VisualBasic is opened. I've tried to narrow it down by using MsgBoxes to find the approximate location where the form crashes, and it seems to happen when the .ListIndex property of a ComboBox is set inside the UserForm_Initialise method. I've played around for days trying to narrow it down further, removing .ListIndex statements as much as possible without breaking the entire thing.
View 2 Replies
View Related
Apr 6, 2014
Not come across this issue before where the Code works once then fails to iterate!
In attached file 140405 Loop not working.xlsm, for each cell in C4:C27 on the Inventory Sheet, the Code should:
Look in the Data Input sheet.
Find the Item Number in Col B corresponding to the number in Col A of the Inventory Sheet.
Find the quantity on the Data Input sheet corresponding to that number.
Copy the quantity into Col H of the Inventory sheet.
The Code works for the first row then throws error message "Run Time error 13" Type Mismatch!
VB:
Sub OFFLOAD()
Dim Dest As Range, Dest1 As Range, oCell As Range
Set Dest = Sheet2.Range("C:C")
Set Dest1 = Sheet2.Range("B:B")
Sheets("INVENTORY").Select
[Code] .....
View 2 Replies
View Related
Jul 21, 2014
I'm building a bookkeeping workbook that is only currently 800kb with TWO cells that have data validation and no cells have conditional formatting. There are a fair few formulae but they are all simply SUM, SUMIF and CONCATENATE.
View 1 Replies
View Related
Mar 9, 2012
I have a genuine copy of office pro 2010. All works fine except excel!
It seems to be mainly on one workbook I have brought over from open office and on a mac! It wont save due to errors it won't tell you about? It then stops responding or crashes? Wont save as etc....
I have repaired, I have even deleted and downloaded a new office pro genuine and installed and doing the same so i guess it has to be the file?
BUT it seems to work on another laptop we have, same file, same excel????
The only thing i seem to be able to find is in the permissions it has an "unknown account"? Also under the file menu where it allows you to check the file it states something about conditional formatting i have used and not being compatible BUT i cant for the life of me find that in the menus to get rid?
View 10 Replies
View Related
Nov 8, 2013
I recently received an .xls book which I then saved as .xlsx (I'm using 2010). There are just under 8,000 rows and 20 columns. File Size 1MB.
The only formulas in the sheet are the ones in a column which I inserted and copied down for all 8,000 rows. Nothing too complicated: no arrays or anything. The sheet calculates fine.
I am simply trying to copy and paste these formulas as values (into the same cells), though at every attempt Excel crashes. I tried on smaller sets of the column and just got it to work for a few hundred rows, though it struggles with any more than that.
I opened a different workbook of mine, and tried the same operation on twice as many cells containing complicated, lengthy array formulas and the action completed instantly.
There is no Conditional Formatting in the book, no code, no 'last cell' issue, no Named Ranges, no external links.
I have even copied the data to a new workbook, then copied the text of just one of the formulas over into this book, added an equals sign, copied down and recalculated, then tried to paste as values again. Still crashes.
Formula:
=IF(AND(N3>1,ROWS($1:1)<>MATCH(M3,$M$3:$M$7979,0)),"Exact Duplicate","")
is far more resource-hungry than I thought, though if that were the case, wouldn't the issue be during calculation (which, as I said, is fine) and not during a paste attempt? No, it can't be this.
View 1 Replies
View Related
Feb 10, 2014
I have one simple (but large table). It has dates across the top (formatted in hh format). I would like the associated table to format according to the day and also to format differently when there is a public holiday. So I have built a table with the holidays and named the relevant cells as "Holiday_Valid".
I have the following formula in the conditional formatting;
[Code]....
Where D11 has the current day in question and Holiday_Valid is a list of public holidays. Since there is a cell for each hour of each day I am using "int()".
There is a second conditional format to format Sundays differently as below;
[Code] .....
My problem is that these both work well....but then after a few minutes the whole sheet crashes with those dreaded "Trying to recover your data" and "Excel will restart" etc.
I have removed references to named ranges and so far - so good....but this means putting the validation table in the same sheet as the main table. In the past I have been able to use named ranges (albeit not in such convoluted formulae), but now it seems that it is not working any longer.
When I open the recovered sheet, all the conditional formatting has been removed and the message from the repairs is that there was some invalid conditional formatting.
Extensive web searches did show some issues with conditional formatting using names ranges....especially with frozen panes....which I need use with a sheet this big.
View 4 Replies
View Related
Sep 18, 2008
Am ai missing something? Are these 2 codes the same for 2 different sheets?
It works on the frst one, but throws an error on the 2nd one.
'Clear Out Invoice Sheet
With Sheets("Enter Invoice Here")
.Cells.Select
Selection.Delete shift:=xlUp
End With
'Clean out Adage Inventory Sheet
With Sheets("Adage Inv")
.Cells.Select
Selection.Delete shift:=xlUp
End With
View 9 Replies
View Related
Feb 9, 2009
i have a button to switch to other sheet in the workbook. I want during the swichting also copy a cell b1 from sheet "view" to sheet "view 2008" but it gives me a error by the second "Range("B1").Select" command here is my code;
View 4 Replies
View Related
Mar 12, 2009
My VB code creates a number of sheets when processing and all works well until I have to create more then 65 sheets and then it stops running with an error 1004. The VB code creates each new work sheet via vb "copy" command.
I assume there is nothing magical about this 65 number - its just the point where excel runs out of memory, maybe?
I found a reference to this problem and a suggestion that I have the code periodically save the work sheet but this seems like a kludge?
View 9 Replies
View Related
Jan 30, 2014
I have a userforms which transfers data to protected sheets.The userforms worked until i protected each sheet.Can there be any code which i add to the current userform code so it can still transfer the data to protected sheets
The other issue also is now that the sheets are protected the Outlining also does not work.Can this also be changed so the Outlining works on protected sheets
I have 5 userforms which all transfer data.
[Code].....
View 5 Replies
View Related
Aug 5, 2006
There is a Microsoft VBA bug currently outstanding where if your VBA replicates a sheet too many times, it throws a run-time error. I read MS' statement that, to get around this problem, what one can do is to save and close the file, and re-open the file once in a while.
Doing this certainly helped, where it used to crash after copying only a few times and now it goes on until 40 ~ 50 times. But it still crashes. Has anybody been able to get around this problem? Currently I am having VBA save, close and re-open the file every 7 or 8 times or so...
View 5 Replies
View Related
Sep 27, 2006
Sub SheetFinder()
Application.MacroOptions Macro:="SheetFinder", _
HasShortCutKey:=True, ShortcutKey:="G"
msg1 = "What sheet would you like to go to?"
msg2 = "I'm sorry, but that sheet could not be found."
On Error Goto NotFound
TryAgain:
prompt1 = InputBox(msg1, , "Template")
If prompt1 = "" Then
End
Else
Sheets(prompt1).Select
End If
End..........
View 9 Replies
View Related
Mar 1, 2007
The following bit of code has been working fine but has now started getting the following error;
Method ' sheets'of object'_global' failed
This kicks in on line 3.
The worst thing is it will not let me get into the workbook at all
Sub KillForm()
'Update Names on Sheets
If Sheets("Daily Visits May").Range("e1") = "y" Then Goto 10
If Sheets("Daily Visits May").Range("d1") > 38837 Then Else Goto 10
Worksheets("Daily Visits Apr").Range("B5:C1500").Copy
Worksheets("Daily Visits May").Select
Range("B5").Select
ActiveSheet.Paste
View 9 Replies
View Related
Jun 27, 2014
I have a macro which creates and names worksheets. I am making a button which also deletes the latest of these created worksheets, but doesn't delete other sheets. I am getting the error: Run-time error '424': Object Required. Here is my code for deleting the sheet:
[Code] .....
MSCount stores the highest "MS#" sheet.
The first line of the IF statement is where the error is.
View 7 Replies
View Related
Mar 5, 2014
I'm trying to set up a macro that will capture all the unique values in a column, and then create a new sheet for each value. What I've got so far technically works, but it's also adding an extraneous sheet (with a generic sheet name, not the specified name I'm giving the sheets) and also giving me "Run-time error '1004': Application-defined or object-defined error" when it runs.
View 3 Replies
View Related
Mar 3, 2009
I created several macros objects to do simple hide columns, filter on, filter off, etc. type functions, using the Tools / Record Macro feature. Then discovered they won't work in a protected worksheet. Is there a way around this situation, other than turning protection off? Here's an example of the code for one of them, although I get the error or every attempt to perform a macro once the sheet is protected:
View 4 Replies
View Related
Oct 21, 2012
How to accomplish the goal described below.
A , Method of Range Object "_Global" Failed , error occurred upon running the code below at the emboldened statement.
Code:
Sub copytosheet2()
Dim Lastrow As Long, CopyRng As Range, DestRng As Variant, i&
Worksheets("Sheet1").Activate
Lastrow = Worksheets("Sheet1").[A65536].End(xlUp).Row
'
For i = Lastrow To 2 Step -1
[Code] ......
The goal is to loop through columns of data on sheet1 and copy values of cells B-C to the lowest rows on sheet2 column B-C.
Here are the screen shots of sheet1 and sheet2.
View 3 Replies
View Related
Feb 11, 2010
I've been trying to use the below code,
Sub combine()
'This will copy data from all sheets of the selected workbooks
'To a sheet named 'Data' in the sheet in which the macro is run from
Dim pasterow As String
mainsheetname = ActiveWorkbook.Name
MsgBox ("Please select spreadsheets to combine")
filestoopen = Application.GetOpenFilename(MultiSelect:=True)...
View 9 Replies
View Related
Nov 30, 2012
I am currently working with a hidden sheetname "hide_template" which contains formula linking to another sheetname "rawdata" of same workbook.
In this "rawdata", the contents is updated from time to time.
The problem is when I open this workbook and update the entries in "rawdata", the formulas/results in "hide_template" is not updated and invalid (ie. #N/A, #VALUE..)
This is the overview of process that Im working with:
===> open workbook ===> paste new entries on "rawdata" ==> run a macro to copy range in the "hidden_template" to paste to new sheet of same workbook
I already have a working macro to copy range from the "hidden_template" which works as follows:
===> set to visible the "hidden_template" ===> copy range from "hidden_template" ===> paste to new sheet ===> set to hidden the "hidden_template"
View 1 Replies
View Related
Apr 20, 2007
I have a spreadsheet which has 3 separate external queries running from worksheet 'A'. My user enters a couple of dates in another worksheet 'B' to supply the date parameters for the query and a macro runs to refresh all of the queries and performs a few calculations.This works fine. The trouble is I don't want the user to be able to view all the data on sheet 'A' only the summary on B. My macro ends up on sheet B but whilst the query is refreshing the raw data is displayed to the user on sheet 'A'. When I hide the sheet 'A' i get a run time error '1004' Select method of worksheet class failed.
View 4 Replies
View Related