+ Reply to Thread
Results 1 to 18 of 18

Can't execute 'Or' Command???

  1. #1
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Can't execute 'Or' Command???

    Hi, I have the following code that activates an error message when C is not combined with 4/10,4/101,4/146 and 5/112.
    However, it calling an error on these options and I can't see how. I realise I should have put this as a Case argument rather than or which leads me to the question. Is there a limitation as to
    how many or commands I can have. Maybe, this is affecting things?






    Please Login or Register  to view this content.

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

    Re: Can't execute 'Or' Command???

    Try this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't execute 'Or' Command???

    Still won't work. It calls an error when the above options are chose. I really can't think why because I tested it earlier and it was fine?

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

    Re: Can't execute 'Or' Command???

    What's the error message?

  5. #5
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't execute 'Or' Command???

    It calls the message box error when I choose "C" combined with "4/146". Whereas, it is supposed to do nothing when they are chosen and to display an error when something
    "other than" is selected. I'm at a loss, Lol

    Do you think I got the "do nothing"command wrong, even though its in a comment
    Attached Images Attached Images

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

    Re: Can't execute 'Or' Command???

    Any chance you could upload a sample workbook?

    Click on GO ADVANCED, scroll down and click Manage Attachments.

  7. #7
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Can't execute 'Or' Command???

    Check for leading/trailing spaces in your input.

    I got the "do nothing"command wrong, even though its in a comment
    How can you get a commented line wrong? It's ignored by the compiler.

  8. #8
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't execute 'Or' Command???

    Yeah, gimme 2 mins :-)

  9. #9
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't execute 'Or' Command???

    Here it is,
    Attached Files Attached Files

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

    Re: Can't execute 'Or' Command???

    Which userform are you having the problem with?

    Have you changed all the other similar If statements in the same way I suggested?

  11. #11
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't execute 'Or' Command???

    its on the 66 sq, I tend to copy to the others.

    No, just the one of the two. I'll change it now, that may be the issue

  12. #12
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't execute 'Or' Command???

    Changed the If statements to include brackets, but still having the problem

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

    Re: Can't execute 'Or' Command???

    That's the one I've been looking at and what I suggested seems to be working.

    You seem to have other similar If statements with similar message boxes, so are you sure you are getting the message box from the one you originally posted?

  14. #14
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't execute 'Or' Command???

    Changed the If statements to include brackets, but still having the problem

  15. #15
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't execute 'Or' Command???

    I'll have another look

  16. #16
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't execute 'Or' Command???

    Have I corrected the statements accurately? Still no joy








    Please Login or Register  to view this content.

  17. #17
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't execute 'Or' Command???

    Got it working now, Thank you very much!!!!!!!

  18. #18
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't execute 'Or' Command???

    You were right. If you add more hubs the code goes a bit nuts. Not sure why,

+ 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. Can't execute an Other Than command
    By bralew in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-13-2017, 05:27 AM
  2. [SOLVED] I cannot execute my case command?
    By bralew in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-04-2016, 09:47 AM
  3. Using macro to execute a command in Shell Command
    By aadarsh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-19-2010, 07:06 PM
  4. A vba code command does not execute as it should...
    By Stu M in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-26-2009, 11:07 PM
  5. execute keystroke command
    By Smed in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-02-2007, 08:57 AM
  6. Execute a ping command
    By Significent in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-21-2005, 09:30 PM
  7. [SOLVED] VBA Equivalent of ASP 'Execute' Command
    By The Vision Thing in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-06-2005, 07:06 PM

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