+ Reply to Thread
Results 1 to 6 of 6

VBA code appears to call a another code but it doesn't actually run

  1. #1
    Registered User
    Join Date
    05-25-2016
    Location
    Erlanger, KY
    MS-Off Ver
    2010
    Posts
    81

    VBA code appears to call a another code but it doesn't actually run

    I have a workbook that is connected through an ODBC to web program. Part of the code is supposed to match an invoice from one worksheet to an invoice on another and then add data to it. It is called by a another set of codes... it does not error out and it actually triggers the clear content section, it does not error out, it appears that it is updating the information but it is not really updated... if I walk through the code by pressing F8, it updates with accurate data. This is the code that I am using, I know the code works from beginning to end as long as I press F8 to get through it.. but there is over 700 rows that I am manually looping through... Can someone look at this code and see if there is something that is obvious to you that I am not seeing. Why would it work manually pressing F8 but not actually update when selecting Run?

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA code appears to call a another code but it doesn't actually run

    Hi,

    It's rather difficult to say without seeing the code in the context of the whole workbook. Sometimes when stepping through code it's easy to start with the wrong Active sheet'. When you step through is the active sheet the same sheet that presumably contains the 'Run' button?

    I see that DC isn't dimmed but maybe you don't have 'Option Explicit' at the top of your code and if so this point is irrelevant.

    Have you tried putting a break point in and then Running the code from the button and starting the code in VBA with the F5 key. Check to see that they both get to the breakpoint, and if so move the breakpoint further to see if you can establish where the difference occurs. You may need to use the WATCH window and set a Break for the Loop section.

    Upload the workbook if you still struggle.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    05-25-2016
    Location
    Erlanger, KY
    MS-Off Ver
    2010
    Posts
    81

    Re: VBA code appears to call a another code but it doesn't actually run

    Thank you for the response... I thought about putting a break in and watch it, but it runs if you F8 through it, so I did not think that putting a break in it would tell me anything... when you run the code, automatically, it gives you the impression that it is running the entire code, but it is clearly not, it only puts the accurate date in the appropriate cells when I F8 through it. I will try and get the file attached, but I think it might be to big..the thing is, when anyone selects Refresh, it will ask for a password because the SQL tables that are linked through an ODBC file. So the refresh part will not work for you when testing it.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    05-25-2016
    Location
    Erlanger, KY
    MS-Off Ver
    2010
    Posts
    81

    Re: VBA code appears to call a another code but it doesn't actually run

    When testing it, I know it is not working when I filter the vendor and see that there is project data in column V, when I filter out everyone but Vernovis, Vernocvis should always be blank...

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA code appears to call a another code but it doesn't actually run

    I suggested a break since you say the F8 runs all the way through, but running the macro, from a button presumably, doesn't.
    Hence a technique I often use is to identify exactly where the difference occurs. It's trial and error but you can usually hone it down by halving the code lines/loop iterations for each test. You're looking to find the position where the break STOPS occurring in both the F8 and Run scenarios.

  6. #6
    Registered User
    Join Date
    05-25-2016
    Location
    Erlanger, KY
    MS-Off Ver
    2010
    Posts
    81

    Re: VBA code appears to call a another code but it doesn't actually run

    Thanks, I tried the break, but could not determine why its breaking. I did add another button and assigned the MatchInv code to it. It works this way, but you have to push 3 buttons to get everything that you need. I guess we will just deal with pressing 3 buttons.

+ 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. VBA code to API call
    By ErgoTeam in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2016, 08:36 AM
  2. Replies: 6
    Last Post: 07-12-2016, 07:38 AM
  3. [SOLVED] Need help with VBA code. Tons of code seperated in two, second part of code doesn't work.
    By FragaGeddon in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 11-30-2015, 11:46 AM
  4. [SOLVED] VBA Code for highlighting cells if it appears elsewhere
    By mpgates in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-11-2013, 02:28 AM
  5. Allow code to run once then not until it's trigger value appears again
    By ozhunter in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-18-2013, 08:04 AM
  6. How do I count how many times a code appears in a column?
    By Leo in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-05-2005, 10:05 PM
  7. [SOLVED] Code in one workbook to call code in another XL file
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-01-2005, 11:05 AM

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