LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default macro wants to exit excel

Glad you got it working.

curlydave wrote:

Thanks Dave,
The problem seems to be the userform1.hide
I therefore changed the worksheetchangecode to

Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
myRow = Target.Row

If Union(Range("$A3:$A20"), Target).Address = Range("$A3:$A20").Address
Then
If Target = "" Then
UserForm1.Hide
Else: UserForm1.Show False
End If
End If

End Sub
this seems to have solved the problem......
Dave Peterson wrote:
I don't see anything that would make excel want to quit.

But can you disable events before you clear the contents?

Sub resetpage()
Range("A3:S20").Select
application.enableevents = false
Selection.ClearContents
application.enableevents = true
Range("A3").Select
userform1.Hide
End Sub

This'll stop the worksheet_change event from firing. Is that what you want?

curlydave wrote:

I don't know why but this macro wants to exit excel when I run it

Sub resetpage()
Range("A3:S20").Select
Selection.ClearContents
Range("A3").Select
userform1.Hide

End Sub
I have userform1.hide because I have a worksheetchange event that goes
like this:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
If Target.Column = 1 Then
userform1.Show False
myRow = Target.Row
End If
End Sub

When I run Sub resetpage()
it clears the contents and then asks if I want to save changes as if I
had clicked exit

Why is this now happening? it doesn't happen all the time ,but it
happens alot


--

Dave Peterson


--

Dave Peterson
 
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
Importing Outlook Alias into an Excel 2003 macro fidgitthedigit Excel Discussion (Misc queries) 0 May 29th 06 02:24 PM
Excel macro [email protected] Excel Discussion (Misc queries) 1 May 27th 06 04:00 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Relative Ranges in excel macro edself Excel Worksheet Functions 6 October 13th 05 02:02 PM
Macro in Excel 2002 to save a workbook to a FTP location Lloyd Excel Discussion (Misc queries) 0 December 21st 04 02:49 PM


All times are GMT +1. The time now is 03:24 PM.

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

About Us

"It's about Microsoft Excel"