Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Syntax to stop code in Watch Window

2003/2007

What is the correct Watch Window syntax to halt code processing?

I want to have the code halt when:

'Sheet1'!A2 changes value (from blank to i.e. 4)


TIA
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,344
Default Syntax to stop code in Watch Window

Hi,

I don't believe the Watch Window can stop code execution. Are you sure you
mean the Watch Window, this window shows the value of a variable as the macro
executes. This is in the VBE (Visual Basic Editor).
--
Cheers,
Shane Devenshire


" wrote:

2003/2007

What is the correct Watch Window syntax to halt code processing?

I want to have the code halt when:

'Sheet1'!A2 changes value (from blank to i.e. 4)


TIA

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Syntax to stop code in Watch Window

Shane,

Actually, I do mean the Watch Window ( VBA ExploereViewWatch Window.

In that window, one can halt the execution of code at the change of a value.

I am not sure of the syntax to watch a cell value of a specified sheet.

EagleOne

ShaneDevenshire wrote:

Hi,

I don't believe the Watch Window can stop code execution. Are you sure you
mean the Watch Window, this window shows the value of a variable as the macro
executes. This is in the VBE (Visual Basic Editor).

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,886
Default Syntax to stop code in Watch Window

Hi

If you have the line of code in your module highlighted, then DebugAdd
Watch will bring that line up as the default in the watch Window.

Or you could type in =Range("A1)=20
and set to Break on True

If you set the Watch to =Range("A1)
and set Break on Change, then every time the value in cell A1 changes
the code will halt.

--
Regards

Roger Govier


wrote in message
...
Shane,

Actually, I do mean the Watch Window ( VBA ExploereViewWatch Window.

In that window, one can halt the execution of code at the change of a
value.

I am not sure of the syntax to watch a cell value of a specified
sheet.

EagleOne

ShaneDevenshire wrote:

Hi,

I don't believe the Watch Window can stop code execution. Are you
sure you
mean the Watch Window, this window shows the value of a variable as
the macro
executes. This is in the VBE (Visual Basic Editor).



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,344
Default Syntax to stop code in Watch Window

Hi Roger,

I agree, but he says the Watch Window codes the stop and you are saying, as
I would that you add the code to break within the module. Isn't this the
case?

--
Cheers,
Shane Devenshire


"Roger Govier" wrote:

Hi

If you have the line of code in your module highlighted, then DebugAdd
Watch will bring that line up as the default in the watch Window.

Or you could type in =Range("A1)=20
and set to Break on True

If you set the Watch to =Range("A1)
and set Break on Change, then every time the value in cell A1 changes
the code will halt.

--
Regards

Roger Govier


wrote in message
...
Shane,

Actually, I do mean the Watch Window ( VBA ExploereViewWatch Window.

In that window, one can halt the execution of code at the change of a
value.

I am not sure of the syntax to watch a cell value of a specified
sheet.

EagleOne

ShaneDevenshire wrote:

Hi,

I don't believe the Watch Window can stop code execution. Are you
sure you
mean the Watch Window, this window shows the value of a variable as
the macro
executes. This is in the VBE (Visual Basic Editor).






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,886
Default Syntax to stop code in Watch Window

The OP actually said "halt", which is exactly what it does.

--
Regards

Roger Govier


"ShaneDevenshire" wrote in
message ...
Hi Roger,

I agree, but he says the Watch Window codes the stop and you are
saying, as
I would that you add the code to break within the module. Isn't this
the
case?

--
Cheers,
Shane Devenshire


"Roger Govier" wrote:

Hi

If you have the line of code in your module highlighted, then
DebugAdd
Watch will bring that line up as the default in the watch Window.

Or you could type in =Range("A1)=20
and set to Break on True

If you set the Watch to =Range("A1)
and set Break on Change, then every time the value in cell A1 changes
the code will halt.

--
Regards

Roger Govier


wrote in message
...
Shane,

Actually, I do mean the Watch Window ( VBA ExploereViewWatch
Window.

In that window, one can halt the execution of code at the change of
a
value.

I am not sure of the syntax to watch a cell value of a specified
sheet.

EagleOne

ShaneDevenshire wrote:

Hi,

I don't believe the Watch Window can stop code execution. Are you
sure you
mean the Watch Window, this window shows the value of a variable as
the macro
executes. This is in the VBE (Visual Basic Editor).






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Syntax to stop code in Watch Window

Thanks Roger & Shane

"Roger Govier" wrote:

The OP actually said "halt", which is exactly what it does.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Syntax to stop code in Watch Window

Roger,

Do you actually mean Range("A1") for Range("A1)?

TIA

EagleOne

"Roger Govier" wrote:

Hi

If you have the line of code in your module highlighted, then DebugAdd
Watch will bring that line up as the default in the watch Window.

Or you could type in =Range("A1)=20
and set to Break on True

If you set the Watch to =Range("A1)
and set Break on Change, then every time the value in cell A1 changes
the code will halt.

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,886
Default Syntax to stop code in Watch Window

Do you actually mean Range("A1") for Range("A1)?

Yes, I did. Apologies for the typo. Didn't even notice when I copied and
pasted it again.

--
Regards

Roger Govier


wrote in message
...
Roger,

Do you actually mean Range("A1") for Range("A1)?

TIA

EagleOne

"Roger Govier" wrote:

Hi

If you have the line of code in your module highlighted, then
DebugAdd
Watch will bring that line up as the default in the watch Window.

Or you could type in =Range("A1)=20
and set to Break on True

If you set the Watch to =Range("A1)
and set Break on Change, then every time the value in cell A1 changes
the code will halt.



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Syntax to stop code in Watch Window

Debug.Assert will break into the running code when it's expression is
evaluated to FALSE. For example:

Debug.Assert Range("A2").Value < 4

This line will stop the code when A2 = 4 because the expression A2<4
= FALSE

Regards,
Dave

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
Stop window saying code execution interrupted at startup? Jerry07 Excel Discussion (Misc queries) 1 August 15th 09 05:16 PM
Watch Window Guilherme Excel Worksheet Functions 0 April 20th 09 02:12 PM
Watch Window Guilherme Excel Discussion (Misc queries) 0 April 20th 09 10:57 AM
WATCH WINDOW [email protected] Excel Programming 4 February 26th 07 04:19 PM
Watch Window Subs Excel Programming 1 August 30th 04 03:18 PM


All times are GMT +1. The time now is 09:57 PM.

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"