+ Reply to Thread
Results 1 to 4 of 4

VBA code behaving differently when stepping

  1. #1
    Registered User
    Join Date
    07-22-2012
    Location
    The Shire
    MS-Off Ver
    Office 2013
    Posts
    51

    VBA code behaving differently when stepping

    I am trying to write code that will handle the "change" event of any ComboBox on my userform.

    I went by this question's answer and created a separate class, etc.

    However, it doesn't work. Using the same code on a new project works fine, this code on this project works sometimes when I use the "step by step" execution (F8), but when using normal running it doesn't.

    Looking at other people's similar predicaments I added "DoEvents" but that didn't help.

    This is my code in the UserForm

    Please Login or Register  to view this content.
    And the class module, named "ComboBox_Class":


    Please Login or Register  to view this content.

    EDIT:

    I was answered on StackExchange - I needed to make the Collection variable public. I just moved it from the UserFrom to the Module and declared it Public.
    Last edited by Durarara; 03-18-2016 at 02:59 PM. Reason: Found the answer.

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: VBA code behaving differently when stepping

    Without having a sample workbook to test, I'm going to try to take a stab at it. I'm not sure that this is even the issue, but, in the link they have there Collection declaration before the sub title. So, instead of
    Please Login or Register  to view this content.
    Should it be
    Please Login or Register  to view this content.
    If that doesn't work, can you attach a sample of your Userform and code?
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Registered User
    Join Date
    07-22-2012
    Location
    The Shire
    MS-Off Ver
    Office 2013
    Posts
    51

    Re: VBA code behaving differently when stepping

    Thanks!

    Sorry, I just didn't expect my question to be answered to quickly on that other place, it was a garbage collector/scope issue.

  4. #4
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: VBA code behaving differently when stepping

    No problem, glad you were able to get it working.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Code works fine when stepping through code but Excel freezes if I run it without stepping
    By OldManExcellor in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-19-2016, 10:39 AM
  2. [SOLVED] 2 copies of Excel 2010 behaving differently.
    By JennyW1983 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-09-2015, 04:36 AM
  3. Stepping through code produces different result than running code
    By Sc0tt1e in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-19-2015, 08:27 AM
  4. Replies: 9
    Last Post: 07-17-2015, 04:08 PM
  5. [SOLVED] Enable / Disable Macros behaving differently in Excel 2003 from Windows XP to Windows 7
    By TC1980 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-21-2013, 09:09 AM
  6. VBA code behaves differently while stepping?
    By mhni in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-10-2009, 09:01 AM
  7. Stepping through Code
    By ben in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-08-2006, 05:50 PM

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