+ Reply to Thread
Results 1 to 4 of 4

Single step works fine but command button has errors

  1. #1
    Registered User
    Join Date
    09-05-2017
    Location
    Woodinville, WA
    MS-Off Ver
    Office 2007
    Posts
    2

    Single step works fine but command button has errors

    I have a long but simple VBA program that hides rows in a spreadsheet depending upon options. Everything works fine when I single step through the program using F8. However, that is not the case when I use a command button to execute. For example, there are eight rows each for Slots C, D and E. For the specific variables, the coding should hide none of C, 4 of D and all of E in workbooks '700G Relay Setting Calcs' and 'Logic Variables'. It does so successfully with single step using F8. When pressing the command button within the spreadsheet, it hides 5 instead of 4 D in workbook '700G Relay Setting Calcs', and none of D and only 3 of E in workbook 'Logic Variables'.

    I don't understand how it would work using F8 but not work when runing the macro automatically. Any ideas on where to start looking for the issue? A sample portion of code follows:


    Please Login or Register  to view this content.
    Last edited by CptCrunch51; 09-05-2017 at 03:22 PM. Reason: Added Code tags

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

    Re: Single step works fine but command button has errors

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    09-05-2017
    Location
    Woodinville, WA
    MS-Off Ver
    Office 2007
    Posts
    2

    Re: Single step works fine but command button has errors

    No input so far. Can anyone direct me to a way to start troubleshooting what is happening?

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Single step works fine but command button has errors

    Hi

    I think you need to post all of the code rather than a snippet, especially if there is any external data involved.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

+ 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. Disable Insert button code works fine, but some times throws Run-Time error '5'
    By challasl in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-18-2016, 05:41 AM
  2. VBA Code works by step by step, doesn't work by running
    By lucasar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-24-2016, 06:33 AM
  3. Command Button Works Sometimes
    By Scrapnforfun in forum Excel General
    Replies: 3
    Last Post: 07-31-2016, 01:24 PM
  4. [SOLVED] Help with modifying VBA Macro - Works fine but needs fine tuning !
    By stefan27 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-06-2015, 10:27 AM
  5. [SOLVED] vba code, command bar, command bar button, one button works but not two
    By amazingg64 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2012, 09:55 AM
  6. Replies: 6
    Last Post: 09-13-2005, 07:06 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