Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
k2c k2c is offline
external usenet poster
 
Posts: 5
Default Changing Watch variable value

Hello, for testing purposes, I would like to change the value of the Watch
variables that I have added to the Watch Window. It appears that I can add,
delete or change the names, but the content itself cannot be altered. Is
there a way to do it as part of the functionality of the Watch Window
feature? Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Changing Watch variable value

Try changing it in the Immediate window.

"k2c" wrote:

Hello, for testing purposes, I would like to change the value of the Watch
variables that I have added to the Watch Window. It appears that I can add,
delete or change the names, but the content itself cannot be altered. Is
there a way to do it as part of the functionality of the Watch Window
feature? Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
k2c k2c is offline
external usenet poster
 
Posts: 5
Default Changing Watch variable value

I opened an Immediate window, and tried the following:

(1) Typed in the variable and its value that I wish to test. Nothing
happened.
(2) Defined the variable, then assigned its value. Didn't work either.

I want to test a subroutine which uses a variable to pass the number of
columns for various reports. I would like to assign different values to this
variable so that I can test this subroutine. Sounds simple & elementary I
thought, but I'm having a hard time.

Please pardon my ignorance, I'm new to VB and its editor...



"JMB" wrote:

Try changing it in the Immediate window.

"k2c" wrote:

Hello, for testing purposes, I would like to change the value of the Watch
variables that I have added to the Watch Window. It appears that I can add,
delete or change the names, but the content itself cannot be altered. Is
there a way to do it as part of the functionality of the Watch Window
feature? Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Changing Watch variable value

As an example of what I'm getting at, if I had the following two macros:

Sub test()
Macro1 5
End Sub

Sub Macro1(lngVar As Long)
lngVar = lngVar * 2
'Change value in the immediate window
MsgBox lngVar
End Sub

If I stepped through Test (F8 key) and passed 5 to Macro1, I can enter:
lngVar = 17
in the Immediate Window and this will change the value of the lngVar
variable. By resuming to step through the macro (F8), the message box
confirms the value of the variable was changed. Is this what you were
wanting to do??



"k2c" wrote:

I opened an Immediate window, and tried the following:

(1) Typed in the variable and its value that I wish to test. Nothing
happened.
(2) Defined the variable, then assigned its value. Didn't work either.

I want to test a subroutine which uses a variable to pass the number of
columns for various reports. I would like to assign different values to this
variable so that I can test this subroutine. Sounds simple & elementary I
thought, but I'm having a hard time.

Please pardon my ignorance, I'm new to VB and its editor...



"JMB" wrote:

Try changing it in the Immediate window.

"k2c" wrote:

Hello, for testing purposes, I would like to change the value of the Watch
variables that I have added to the Watch Window. It appears that I can add,
delete or change the names, but the content itself cannot be altered. Is
there a way to do it as part of the functionality of the Watch Window
feature? Thanks.

  #5   Report Post  
Posted to microsoft.public.excel.programming
k2c k2c is offline
external usenet poster
 
Posts: 5
Default Changing Watch variable value

You got the idea, this is an alternative of what I want to do. I've worked
with a debugger years ago where this feature is included in the "watch"
window. The value of any variable listed in the watch window could be change
anytime or at a breakpoint - much simpler & convenient. At least this
confirms my obstacle with the VB editor. Thanks much for your help!

"JMB" wrote:

As an example of what I'm getting at, if I had the following two macros:

Sub test()
Macro1 5
End Sub

Sub Macro1(lngVar As Long)
lngVar = lngVar * 2
'Change value in the immediate window
MsgBox lngVar
End Sub

If I stepped through Test (F8 key) and passed 5 to Macro1, I can enter:
lngVar = 17
in the Immediate Window and this will change the value of the lngVar
variable. By resuming to step through the macro (F8), the message box
confirms the value of the variable was changed. Is this what you were
wanting to do??



"k2c" wrote:

I opened an Immediate window, and tried the following:

(1) Typed in the variable and its value that I wish to test. Nothing
happened.
(2) Defined the variable, then assigned its value. Didn't work either.

I want to test a subroutine which uses a variable to pass the number of
columns for various reports. I would like to assign different values to this
variable so that I can test this subroutine. Sounds simple & elementary I
thought, but I'm having a hard time.

Please pardon my ignorance, I'm new to VB and its editor...



"JMB" wrote:

Try changing it in the Immediate window.

"k2c" wrote:

Hello, for testing purposes, I would like to change the value of the Watch
variables that I have added to the Watch Window. It appears that I can add,
delete or change the names, but the content itself cannot be altered. Is
there a way to do it as part of the functionality of the Watch Window
feature? Thanks.



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
Changing the name of a variable using code [email protected] Excel Programming 3 January 11th 07 03:19 AM
How do I add a variable to watch in hex? Dave[_62_] Excel Programming 2 December 9th 05 03:31 AM
Changing a variable with a SLIDE-BAR. Ricky Gibson Excel Programming 2 October 7th 05 01:20 PM
Changing a Formula Variable David Excel Programming 4 June 3rd 05 11:50 AM
How do I watch a variable change value during Visual Basic Code e. Stewart1234 Excel Programming 6 December 18th 04 06:53 PM


All times are GMT +1. The time now is 04:30 AM.

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"