+ Reply to Thread
Results 1 to 8 of 8

VBA to add and modify a Watch window in excel

  1. #1
    Registered User
    Join Date
    08-29-2012
    Location
    South Yorks, England
    MS-Off Ver
    Excel 2010
    Posts
    32

    VBA to add and modify a Watch window in excel

    I need to add a macro to an excel workbook that will add a watch window, then reduce the width of all the columns except the Value one.

    I know the procedure is quick to do once you know it but I need to add a macro because the workbook will be used by people with little knowledge of excel.

    Hope that someone can give me a code or clue (I'm new to VBA).
    Last edited by bensox; 04-25-2013 at 10:21 AM.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: VBA to add and modify a Watch window in excel

    you'd find it a lot easier to create a userform that performs your watch rather than trying to alter the watch window I reckon. I believe there's a youtube video of Bill Jelen showing how to do exactly that
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA to add and modify a Watch window in excel

    bensox

    I don't think it's actually possible to programmaticlly access/manipulate the Watch window using VBA.

    Why do you want to?

    About the best you can do is display the window and add watches.

    See http://www.excelforum.com/excel-programming-vba-macros/714493-programatically-add-watches-to-the-vbe-watch-window.html
    Last edited by Norie; 04-25-2013 at 06:17 AM.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    08-29-2012
    Location
    South Yorks, England
    MS-Off Ver
    Excel 2010
    Posts
    32

    Red face Re: VBA to add and modify a Watch window in excel

    Quote Originally Posted by Norie View Post
    bensox

    Why do you want to?

    About the best you can do is display the window and add watches.

    See http://www.excelforum.com/excel-prog...ch-window.html
    Good question! I use it as a live 'Post-It' note so the Job List that is on an excel sheet stays visible whilst I work - nothing technical, just thinking outside the box http://www.excelforum.com/images/smilies/wink.gif

    Thank you for the link; that has solved my problem as my 'Watch' needs to link to a constant range. Interestingly, the first few times I activated the macro to show the Watch I had to manually manipulate the columns each time but now, when I close and re-activate it keeps the column widths that I want.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA to add and modify a Watch window in excel

    Why would you want to use the Watch window, a debug tool, for that?

    Couldn't you create a userform, as Joseph suggested, to display the Job List?

  6. #6
    Registered User
    Join Date
    08-29-2012
    Location
    South Yorks, England
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: VBA to add and modify a Watch window in excel

    Norie

    'cos I didn't know how to do userforms or what their potential is... I'm going to look into them this evening (not allowed to access Joseph's suggestion during office hours). I didn't know what the Watch Window was for exactly, just found it and thought "what can I do with this?" my posting this wouldn't help my reputation for knowledge but maybe for honesty!!

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA to add and modify a Watch window in excel

    Well, for what you want to do a userform should be straightforward.

    For example to show a list of items/jobs you could use a listbox populated from a range on a worksheet, or some other source.

    If you want to try a userform and need help post back.

  8. #8
    Registered User
    Join Date
    08-29-2012
    Location
    South Yorks, England
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: VBA to add and modify a Watch window in excel

    Thanks, Norie
    I have been reading various posts and started creating a userform but I can't get it to show. I posted this question as a new thread to keep things tidy:
    HTML Code: 

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1