VBA Code Causing Intermittent Crashes
Aug 12, 2008
I have a set of userforms, two of which are big with 4 pages and many buttons, labels and textboxes that run or are involved in code being run from user input to the userform.
For some reason certain codes are cauing excel to fully crash, executing these codes will make excel crash each time and the only way to prevent it (that I have found) is to open the userform in VB editor and then close VB editor again, the code will then work perfectly for a while and then it will start crashing again (it is normally a few saves and open/closes later that this occurs).
Logically thinking, opening the userform in VB must reset something that gets corrupted or set incorrectly....
View 7 Replies
ADVERTISEMENT
Feb 6, 2009
I have written a fairly large spread sheet, and I have consistently had excel crashes when the first form initialises at startup.
However if I resave the workbook over itself or sometimes as another name it will then work. Once it works - it will always work while I dont restart my computer. The next day the same workbook will crash on form startup. Once this happens t always crashes on startup. If it works OK first up it always works. However if I edit it the process may happen all over again. I am 100% their is no error in the code as in certain stages it has worked for months. It seams like some bug in excel?
Has anyone ever had this issue?
View 9 Replies
View Related
Dec 31, 2008
I recently added some command buttons to 6 excel files each with about 20 sheets. most of the sheets got 6 new buttons. After I added the buttons I would get memory errors when I treied to open other files. So I upgraded to Office 2003 and Excel 2003 because I read that it had increased memory available. It did not seem to help much, and now on average about evry say 10 minutes Excel hangs for about 1o seconds, sometimes saying "Not Responding" up the top. Then it starts working again. MY PC has Server 2003 and 1GHz and 512MB of Ram. Here is some info:
=INFO("memavail")1048576
=INFO("memused")50769256
=INFO("totmem") 51817832
=INFO("numfile") 173
=INFO("osversion")Windows (32-bit) NT 5.02
=INFO("release") 11.0
I do not think the PC memory or chip is being stressed it seems to be Excel's memory?
View 4 Replies
View Related
Mar 3, 2008
I seem to have a bug i can't quite figure out with my code - its causing excel to crash each time it reaches this line (when its commented out - the form runs fine - otherwise "excel has encountered an error")....
Set frameFullX = frameFull.Controls.Add("Forms.frame.1", "frameFull1")
frameFullX is declared as a control and frameFull is a frame already on the userform.
Anyone know what I might be doing wrong (I'm going to try restarting and see if was just an issue with my machine or not?
View 6 Replies
View Related
Feb 6, 2009
I have a multipage userform with about 7 pages. When page 5 is activated, it caused excel to completely lock up. This does not happen everytime but randomly, and I can't seem to figure out what is causing this.
Here is the code -
If Me.MultiPage1.Value = 5 Then
Call LaborCosts
End If
Sub LaborCosts()
If Not Range("A46").Text = "" Then
frmpricingtemplate.Label29.Visible = True
frmpricingtemplate.TextBox46.Visible = True
frmpricingtemplate.Label29.Caption = Range("A46").Text
Else
View 9 Replies
View Related
Nov 30, 2009
I have a rather large workbook (30 sheets, 10MB) that has one worksheet with many INDIRECT functions in it (pulling data from the same file, different tabs). I am working to put simple code into the workbook to protect and/or unprotect all worksheets. I have gotten code to work to both protect and unprotect all the sheets, but when I run the unprotect code (see below), and then I go to edit the workbook, data from the sheet with many "indirect" functions temporarily "overwrites" the data on the active sheet (this is fixed when I scroll my mouse over the effected cells). I am developing this workbook for other users, so I'd like to fix this before sending it off to them.
This problem does not happen until after I run the following .....
View 14 Replies
View Related
Jul 22, 2009
In the situation where I shut down my model (i.e. not just press Ctrl+S, but shut it down), the following code saves the model twice. I only want it to save once. I really can't see why it saves a second time.
NB: I know if you set Cancel to True in the BeforeSave event, it should prevent the model from saving after the event, but even when set to true in the below code, it still saves...
Private Sub Workbook_BeforeClose(Cancel As Boolean)
bIsClosing = True 'Given we shut model, this public bIsClosing is set to true...
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim wsArray() As Variant
Dim iCnt As Integer
Dim wsSht As Worksheet
Application. ScreenUpdating = 0
Splash.Visible = True 'Splash is codename for warning spreadsheet, this is left
'visible while all other sheets are to be hidden.......................
View 9 Replies
View Related
Jun 19, 2007
Hello, I'm using VBA to produce a combo box for any cell using data validation list.
This way the cell auto completes as well as displays as many fields as desired...I now have it functioning so that when you click on any cell that contains data validation list assigned to it, it will create the combo box in the cell for you...It functions great most of the time, however the sheet is used all day long and on a average 10 hour day it causes Excel to crash about 3-5 times. ....
View 9 Replies
View Related
Apr 9, 2009
The code below resides in my personal.XLS Module. When I step through the code everything works till it reaches the point in red then I get the pop up that says excel needs to close and asks to send or not to send.
I noticed that if I choose recover my work and restart excel and I look at the code in THISWORKBOOK of the recovered workbook that the code I wanted placed there is there.
Can anyone explain why this is happening? I have the macro's security set to low and a check mark in the trust access to vb projects.
Any Idea's how to fix this?
View 6 Replies
View Related
Jul 26, 2009
I have comment blocked the code that causes Excel to crash.
View 4 Replies
View Related
Jun 12, 2007
I have 2 macros: 1 controlled by a checkbox activex (PA_03) and the other a combobox (PA_03_rows) in a worksheet. I display the results from PA_03, and the user than then increase or decrease the number by using the combobox. But when I change the value (PA_03_rows.value = x) it causes the macro to jump to the macro.
I don't think it did initially, but it does now. According to another post, I saw it shouldn't do it! Is there something I'm just not seeing here?
Private Sub PA_03_Click()
Dim message, title, default, numberRows
Dim PA_rows As Integer
Application. ScreenUpdating = False
TakeFocusOnClick = False
Worksheets("sheet1").Select
ActiveSheet. Range("a15").Select
If PA_03.Value = True Then Goto Unhide:
If PA_03.Value = False Then Goto Hide:
Unhide:
message = "Enter the number of input rows required (1 to 50)"
title = "Non-Featured Standard Input"
default = "1"
View 4 Replies
View Related
Feb 3, 2014
I am creating a report which lists gifts during a two week time period. Most donors have only one gift, listed in column C and D. Some donors have donated twice or three timies in the two week period. I would like these entries, which are intermittent in Cloumns H-I and K-L, to be automatically moved under the corresponding cells in columns C and D. This way an individuals two or three donations all end up in one column.
View 4 Replies
View Related
Jul 8, 2007
I am analysing market data to determine when trades should take place and when they should be closed. This works well. But I need to find the intermittent high value between the dates for purchase and the closing trades, and then insert these values in column S in the attached worksheet.
I don't know if a function can find these values or if a macro is needed (or if I should amend the existing macro that currently finds the
closing trades).
This macro is included in the attached spreadsheet. It Is:
....
View 9 Replies
View Related
Jun 13, 2014
K
L
M
N
L
L
-2.33
View 6 Replies
View Related
May 3, 2007
I searched the forum for an answer to my problem since I'm positive its a FAQ. Well I was right and many other users have asked a similiar question. My problem is this: I am looking to find the average of a set of numbers in column T that meets certain criteria. I was suggested by other user to use this function which finds me the total number. =SUMPRODUCT(--($E$1:$E$400="S"),--($H$1:$H$400=17),--($U$1:$U$400<>"BEBLT"),--($U$1:$U$400<>"NVLIV"),--($T$1:$T400 > 0),$T$1:$T$400)
I have tried inputing Count, Countif, Average in place of Sumproduct as well as Count enclosing the entire sumproduct function. Nothing seems to work for me. I have also tried using a SQL statement in my VBA to provide a count but it doesn't seem to produce the required result. The above function works like a charm for finding the sum, but I need to find the average of this number thus I am looking for the Count equivilant. I'm sure this is a simple problem and I'm still a rookie when it comes to functions in excel.
View 5 Replies
View Related
Apr 9, 2008
I have having alot of frustation with a big group of Macro's I have written,
all the macros work and run fine most of the time but they crash Excel on occasion and the only way I have been able to fix it is to go into Visual Basic and opening the project up (it is password protected) but not making any changes, after doing this it seems to magically stop crashing, for a while, then doing it again.
I can't work out how or why that would make a difference,
I dont expect you to try and work out a problem in the code or anything like that cause it is too big and would be unreasonable of me to ask,
What I would like to know is if anyone else is aware of this sort of issue, why it happens and if there is any good cure for it?
I am running excel 2003 if that also makes any difference.
View 5 Replies
View Related
Apr 10, 2008
I've created a price sheet that I distribute to customers that is very customer specific. I have to add spacing, logo's, borders and highlighting depending on the products being listed. Because of all of this specialization I'm controlling the page breaks and overflow. I have a counter to keep the current line number of the report and another to determine the row within the current page. I've designed my form to have 77 lines per page and I call a pagebreak/overflow routine when I hit line 72 of each page. Works perfectly when I test on my PC and works about 80% of the time when I send to customers, but I have about 20% who have problems with page size and overflow. In working with them I've found that it's not just the printed copy, but also when they print preview on screen. The first few lines of the second page print at the bottom of the first, so the top of page two is cut off. Then 4 lines from page three print at the bottom of two and so on...
View 3 Replies
View Related
Mar 16, 2009
I am charting the following data (for a lot of countries, and the data changes based on a pull down menu which selects the country).
Yr1Yr2Yr3Yr4Yr5
Country1167155175188155
Country2145n.a.150140166
Country3142154n.a.170160
What I don't want is the line on the chart plummeting to zero when there is a "-", i.e. no value.
If I chart this instead:
Yr1Yr2Yr3Yr4Yr5
Country1167155175188155
Country2145[.....]150140166
Country3142154[.....]170160
..., where [.....] means a blank cell, then the 145 does now show up at all.
View 5 Replies
View Related
Nov 10, 2013
I've got a spreadsheet that lists employee hours worked by week, I'm trying to create a function that would give an automatic look-back of both 90 days and 6 months. I've found some useful answers in other threads, but they tend to hinge on a zero value cell signaling the latest week (not) worked; however, for this purpose, some employees may have zero value fields for some weeks but have worked others.
I'm looking for a formula that can be uniformly applied to all employees in the spreadsheet and average their weekly hours for the past 90 or 180 days without having to update the formula each week new hours are entered.
View 3 Replies
View Related
Jan 4, 2010
Intermittent run-time error '75'
Could not find the specified object.
Debug shows VBA Code that simply loads a form called controls
Sub loadcontrols()
Load Controls
Controls.Show
End Sub
Generally works upon restart. Can load and unload the form numerous times. Seems loading the form after a few minutes results in the form failing to load generating the error. Found no consistent cause thus far.
Results in a hard crash: Restart Excel as only option.
The Form Code for Controls loads a modeless transaprent form. Has been working for months. Don't know if this error is new or has been there all along.
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Const GWL_STYLE As Long = (-16)
Private wHandle As Long 'For moving the form
Private m_objCFormSkin As CFormSkin 'For transparancy
View 9 Replies
View Related
Mar 10, 2009
My formula to add a row to a worksheet worked fine, except for the fact that it was including items with 0%. I need items with >0% but <=50%.
Here's the code that sorta works...
View 6 Replies
View Related
Mar 10, 2014
why the following code generates an error if I use the backspace key to clear the textbox?
Code:
Dim t As Date
If Len(Controls.Item("txtstart").Value) = 4 Then
On Error Resume Next
t = TimeSerial(Left(Controls.Item("txtstart").Value, 2), Right(Controls.Item("txtstart").Value, 2), 0)
On Error GoTo 0
ElseIf Len(Controls.Item("txtstart").Value) = 5 Then
On Error Resume Next
[code]....
View 9 Replies
View Related
Apr 15, 2014
I have a piece of code in one of my Macro's, if I run the macro and don't let this piece of code run everything works fine, when I let this piece of code execute the excel file keeps running until I go to save, at which point I get a message saying "Microsoft office excel has encountered a problem and needs to close. We are sorry for any inconvenience".
Code is as follows:
If MsgBox("Copy and hardcode this scenario?", vbYesNo) = vbYes Then
Calculate
Application.DisplayAlerts = False
[Code]....
View 3 Replies
View Related
Apr 26, 2007
I'm testing some userform code & it seems to cause some sort of lockup where I can't enter anything into the excel cells. It doesn't just affect the spreadsheet the userform is attached to but any spreadsheet that I have open.
View 5 Replies
View Related
Dec 31, 2013
I am creating a line graph to display changes in Cost Per Unit (CPU) of a given item over time.
The issue I have is that the CPU data on the line graph is displayed as 0 values where data is yet to be inputted. Instead I want the graph to remain blank where no data has yet been added. How can this be done?
find attached a simplified mock up of the spreadsheet.
Constant (fixed) values are:
- Date
- Hourly Rate
Values inputted on a daily basis are:
- Hours Worked
- Volume Picked
Calculated values are:
- Total Cost
- Cost Per Unit
- Mean [=average(CPU)]
- UWL [=mean+(2*stdev(CPU))]
- UAL [=mean+(3*stdev(CPU))]
I'm open to using VBA if necessary, however as I will not be the only user of this workbook when it is complete I would prefer to keep it a simple as possible.
View 3 Replies
View Related
Aug 27, 2009
I want to say thanks for any help you might be able to offer. Attached are 2 sheets out of a workbook I am using which has many sumproduct formulas. On the the Input sheet, is where vacation and training forecast dates are listed. On the Calcs sheet, there are 2 monthly calendars for the year, 1 for vacation, the other for training. Would like to know if there is a way to have both records show up on only one calendar set. I currently have the vacation shown as a '1' and the training shown as a '9'. The workbook is used in Excel 2003 & 2007.
View 5 Replies
View Related
Jan 30, 2010
I am trying to sort a database with about 500,000 names. For some reason, about half my data has leading spaces and half do not. I have taken a screenshot at the divide so you can see what I mean. The sort in the picture is in this order:
Column D
Column C
Column A
Is there any way to mass purge these leading spaces in Column D (column b also has the issue but the fix is not nearly as important as for column D)?
View 2 Replies
View Related
Mar 14, 2007
I have an action that deletes a row, and decrements rows counter by one. But, if the user manually deletes one row, I don't get that information (decrementation). Workbook pretection is out of the option.
What are my choices?
I was thinking, is it possible to capture a delete event in general, and add some code to it? Or maybe even completely disable it?
View 9 Replies
View Related
Aug 17, 2009
The IF formula works if placed in a cell, but Vba doesn't seem to like the Quotation Marks in Rc11="".
View 2 Replies
View Related
May 27, 2009
Using Excel 2003, I'm summarizing info in one sheet (Review) with data in another worksheet (Work Orders). The following SUMPRODUCT calc worked fine...
View 2 Replies
View Related