Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
crash when exit excel 97
I have a program that I designed in excel 2000. When I
run it in 97, there is a glitch. When I double click an item in a listbox, the code below is ran. It works fine but when I exit the program I get "excel has errors and will shut down.." Not a big deal I guess since I was closing anyway but the program is not saved and it does not look good. While in the program, everything works as it should and I won't get the error as long as I don't double click an item in this listbox. I do not have any code that runs on close. Anyone have any idea what might be causing this problem?? Thanks in advance for any help provided. Christy Private Sub lbPending_DblClick(ByVal Cancel As MSForms.ReturnBoolean) ufEntry.Hide 'when an item is double clicked in the 'pending transactions' listbox 'bring up the create userform and populate with the entries made so far Dim Rowcnt As Long Dim r As Long Rowcnt = 0 For r = 0 To lbPending.ListCount - 1 If lbPending.Selected(r) Then Rowcnt = r + 2 'listcount begins with 0 and row 1 is headings so we add 2 'to match the row # with the listindex # Dim how As String how = Sheet2.Range("a" & Rowcnt).Value Select Case how Case "ebuy" ufCreate.obebuy.Value = True Case "PS7381" ufCreate.ob7381.Value = True Case "NA" ufCreate.obNA.Value = True End Select how = "" Sheet2.Columns("B:B").EntireColumn.Hidden = False ufCreate.tbApprovalDate.Value = Sheet2.Range("b" & Rowcnt).Text Sheet1.Columns("B:B").EntireColumn.Hidden = True ufCreate.tbOrderDate.Value = Sheet2.Range("c" & Rowcnt).Text ufCreate.tbDescription.Value = Sheet2.Range("d" & Rowcnt).Text ufCreate.cbCatagory.Value = Sheet2.Range("e" & Rowcnt).Text ufCreate.cbVendor.Value = Sheet2.Range("f" & Rowcnt).Text ufCreate.tbInvoiceNum.Value = Sheet2.Range("g" & Rowcnt).Text ufCreate.tbReceiveDate.Value = Sheet2.Range("h" & Rowcnt).Text ufCreate.tbPaidDate.Value = Sheet2.Range("i" & Rowcnt).Text ufCreate.cbMethod.Value = Sheet2.Range("j" & Rowcnt).Text ufCreate.tbCost.Value = Sheet2.Range("k" & Rowcnt).Text 'Now remove the transaction from the pending list 'Deleteing something in the rowsource will crash in excel 97 Dim rng As Range Set rng = Range(lbPending.RowSource) lbPending.RowSource = "" Sheet2.Range("a" & Rowcnt).EntireRow.Delete lbPending.RowSource = rng.Resize(rng.Rows.Count - 1).Address(external:=True) End If Next r Set rng = Nothing ufCreate.Show End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2007 UDF crash | Excel Discussion (Misc queries) | |||
Excel Crash with functions | Excel Worksheet Functions | |||
Excel Crash - Help! | Excel Discussion (Misc queries) | |||
Excel 2003 Crash | Excel Discussion (Misc queries) | |||
Excel Crash - XP & 2003? | Excel Discussion (Misc queries) |