Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Don Don is offline
external usenet poster
 
Posts: 487
Default Break out of a loop in Excel2007?

I created some code that gets Excel in a loop when I open the file and I need
to know how to break out? It is in the Sheet option using the
Application.EnableEvents in Office 2007 and will not let me break out of the
loop and I have to close doing a cntl+alt+delete and hard crashing Excel.

I have updated I think all the files, but if I have some not updated and
people move to Office 2007, I would like another way to get out?

Any help?

see code below from the sheet

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Range(Cells(6, 6), Cells(7, 7)).Select
Selection.ClearContents
Application.EnableEvents = False
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 320
Default Break out of a loop in Excel2007?

Change to:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Range("F6:G7")ClearContents
Application.EnableEvents = True
End Sub

"Don" wrote in message
...
I created some code that gets Excel in a loop when I open the file and I
need
to know how to break out? It is in the Sheet option using the
Application.EnableEvents in Office 2007 and will not let me break out of
the
loop and I have to close doing a cntl+alt+delete and hard crashing Excel.

I have updated I think all the files, but if I have some not updated and
people move to Office 2007, I would like another way to get out?

Any help?

see code below from the sheet

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Range(Cells(6, 6), Cells(7, 7)).Select
Selection.ClearContents
Application.EnableEvents = False
End Sub




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 703
Default Break out of a loop in Excel2007?

Hi

You have to set EnableEvents = False before anything else, and set
=true again later:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Range(Cells(6, 6), Cells(7, 7)).ClearContents
Application.EnableEvents = True
End Sub

Best regards,
Per

On 1 Maj, 20:56, Don wrote:
I created some code that gets Excel in a loop when I open the file and I need
to know how to break out? *It is in the Sheet option using the
Application.EnableEvents in Office 2007 and will not let me break out of the
loop and I have to close doing a cntl+alt+delete and hard crashing Excel. *

I have updated I think all the files, but if I have some not updated and
people move to Office 2007, I would like another way to get out?

Any help?

see code below from the sheet

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range) * *
* * Range(Cells(6, 6), Cells(7, 7)).Select
* * * * Selection.ClearContents
* * Application.EnableEvents = False
End Sub


  #5   Report Post  
Posted to microsoft.public.excel.misc
Don Don is offline
external usenet poster
 
Posts: 487
Default Break out of a loop in Excel2007?


thanks,

but if I am in a loop, how can I get out??
I will change going forward.

"Per Jessen" wrote:

Hi

You have to set EnableEvents = False before anything else, and set
=true again later:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Range(Cells(6, 6), Cells(7, 7)).ClearContents
Application.EnableEvents = True
End Sub

Best regards,
Per

On 1 Maj, 20:56, Don wrote:
I created some code that gets Excel in a loop when I open the file and I need
to know how to break out? It is in the Sheet option using the
Application.EnableEvents in Office 2007 and will not let me break out of the
loop and I have to close doing a cntl+alt+delete and hard crashing Excel.

I have updated I think all the files, but if I have some not updated and
people move to Office 2007, I would like another way to get out?

Any help?

see code below from the sheet

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Range(Cells(6, 6), Cells(7, 7)).Select
Selection.ClearContents
Application.EnableEvents = False
End Sub





  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Break out of a loop in Excel2007?

Hi Don

You can use 'Ctrl'+'Pause/Break' buton to break a running code...
You can even give it a try......

If this post helps click Yes
---------------
Jacob Skaria


"Don" wrote:

I created some code that gets Excel in a loop when I open the file and I need
to know how to break out? It is in the Sheet option using the
Application.EnableEvents in Office 2007 and will not let me break out of the
loop and I have to close doing a cntl+alt+delete and hard crashing Excel.

I have updated I think all the files, but if I have some not updated and
people move to Office 2007, I would like another way to get out?

Any help?

see code below from the sheet

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Range(Cells(6, 6), Cells(7, 7)).Select
Selection.ClearContents
Application.EnableEvents = False
End Sub


  #8   Report Post  
Posted to microsoft.public.excel.misc
Don Don is offline
external usenet poster
 
Posts: 487
Default Break out of a loop in Excel2007?

sorry, the loop is because enable events is turned on and if there is an
update on the page, it will start from the top again. Should be turning it
to off first so it will go through once but it gets stuck in 2007 and will
not let you break out

"Don Guillett" wrote:

That's why I put ??. Where is the loop?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don" wrote in message
...

thanks,

but if I am in a loop, how can I get out??
I will change going forward.

"Per Jessen" wrote:

Hi

You have to set EnableEvents = False before anything else, and set
=true again later:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Range(Cells(6, 6), Cells(7, 7)).ClearContents
Application.EnableEvents = True
End Sub

Best regards,
Per

On 1 Maj, 20:56, Don wrote:
I created some code that gets Excel in a loop when I open the file and
I need
to know how to break out? It is in the Sheet option using the
Application.EnableEvents in Office 2007 and will not let me break out
of the
loop and I have to close doing a cntl+alt+delete and hard crashing
Excel.

I have updated I think all the files, but if I have some not updated
and
people move to Office 2007, I would like another way to get out?

Any help?

see code below from the sheet

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Range(Cells(6, 6), Cells(7, 7)).Select
Selection.ClearContents
Application.EnableEvents = False
End Sub




  #9   Report Post  
Posted to microsoft.public.excel.misc
Don Don is offline
external usenet poster
 
Posts: 487
Default Break out of a loop in Excel2007?

sorry, tried that an no luck.

"Jacob Skaria" wrote:

Hi Don

You can use 'Ctrl'+'Pause/Break' buton to break a running code...
You can even give it a try......

If this post helps click Yes
---------------
Jacob Skaria


"Don" wrote:

I created some code that gets Excel in a loop when I open the file and I need
to know how to break out? It is in the Sheet option using the
Application.EnableEvents in Office 2007 and will not let me break out of the
loop and I have to close doing a cntl+alt+delete and hard crashing Excel.

I have updated I think all the files, but if I have some not updated and
people move to Office 2007, I would like another way to get out?

Any help?

see code below from the sheet

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Range(Cells(6, 6), Cells(7, 7)).Select
Selection.ClearContents
Application.EnableEvents = False
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
Macros in Excel2007 Arvi Laanemets Excel Discussion (Misc queries) 5 May 9th 08 06:33 AM
Need Help with Excel2007 Buzz Local#30 Excel Worksheet Functions 1 April 21st 08 03:56 AM
excel2007 hotkey L@ja New Users to Excel 0 January 29th 08 12:23 PM
where is excel2007 installed? Aqueous Setting up and Configuration of Excel 5 May 8th 07 06:07 PM
Break cell into multiple lines by line break Chia Excel Discussion (Misc queries) 1 August 20th 06 06:37 AM


All times are GMT +1. The time now is 01:15 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"