Online
 
Friday, 21 November 2008
 
 

Debugging using watches - Excel | Print |  E-Mail
 

You've just spent over an hour writing just the macro you need. It's the one that will make your life easier, and you just got it right—or so you thought. But now it's providing the wrong data output, and you can't figure out why. All the code looks right.

One of the great debug tools in the VBA Editor is called a watch expression. Watch expressions allow you to see the values of the variables in your macro at any given time. You can use them with the Step commands to walk though your code. These values can be a big help in finding out why your macro is generating the wrong data. You can use the watch expressions to see your variable values and then compare them to what they would be if your macro were working correctly.

To access the Watch window, just click View | Watch Window in the VBA Editor. To add a watch, right-click a variable and select Add Watch from the shortcut menu. This brings up a dialog box that gives you options about the new watch.

This entry was posted on . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a comment. Tags: Microsoft Excel, Office, Tutorial Office, Excel.
Users' Comments (0)

Comment an article
  Name
  E-mail
   Title
Available characters: 4000
 Notify me of follow-up comments
This image contains a scrambled text, it is using a combination of colors, font size, background, angle in order to disallow computer to automate reading. You will have to reproduce it to post on my homepage
Enter what you see:

No comment posted

Jumbo Coklat
 
Top! Top!