Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 UDF crash Dssg Excel Discussion (Misc queries) 2 May 8th 08 02:53 PM
Excel Crash with functions Vinod[_2_] Excel Worksheet Functions 0 November 6th 07 07:24 PM
Excel Crash - Help! Delbert Excel Discussion (Misc queries) 13 December 13th 05 10:02 PM
Excel 2003 Crash Delbert Excel Discussion (Misc queries) 0 December 12th 05 08:21 PM
Excel Crash - XP & 2003? Howard Excel Discussion (Misc queries) 0 May 18th 05 07:57 AM


All times are GMT +1. The time now is 06:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"