+ Reply to Thread
Results 1 to 12 of 12

Help with a VBA condition

  1. #1
    Registered User
    Join Date
    06-28-2015
    Location
    England
    MS-Off Ver
    2013
    Posts
    39

    Help with a VBA condition

    Hi

    I have this VBA code but I would like it to not produce an error message if the TextBox is left blank.

    Please Login or Register  to view this content.
    Thanks

    Don
    Last edited by DonJuan85; 06-28-2015 at 04:29 PM.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Help with a VBA condition

    Hi Don and Welcome to ExcelForum,

    Try the following (changes in red):
    Please Login or Register  to view this content.
    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.

    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)

    I answered your question because this is your first post.

    Lewis
    Last edited by LJMetzger; 06-28-2015 at 05:09 PM. Reason: Added additional red around Else part of ElseIf

  3. #3
    Registered User
    Join Date
    06-28-2015
    Location
    England
    MS-Off Ver
    2013
    Posts
    39

    Re: Help with a VBA condition

    Thank you. I was unaware of this or how to do it.

    Noted.

    Thanks

    Don.

  4. #4
    Registered User
    Join Date
    06-28-2015
    Location
    England
    MS-Off Ver
    2013
    Posts
    39

    Re: Help with a VBA condition

    Unfortunately I get the error..

    Compile error:

    Block If End If

  5. #5
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Help with a VBA condition

    Quote Originally Posted by DonJuan85 View Post
    Unfortunately I get the error..

    Compile error:

    Block If End If
    Make sure the line below the one in red matches also. He changed that from a plain If statement to an ElseIf, this could be the issue.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  6. #6
    Registered User
    Join Date
    06-28-2015
    Location
    England
    MS-Off Ver
    2013
    Posts
    39

    Re: Help with a VBA condition

    Perfect, thanks.

    Also - A bit off topic but do you know how I can create a command button to go to the next tab on a MultiPage user Form? It is the code I am struggling with as I cannot reference the tab for some reason.

    Thanks

  7. #7
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Help with a VBA condition

    Thanks Sky. See the additional red in my post above. Sorry for the misunderstanding.

    Lewis

  8. #8
    Registered User
    Join Date
    06-28-2015
    Location
    England
    MS-Off Ver
    2013
    Posts
    39

    Re: Help with a VBA condition

    That's OK. Do you have an answer for the question above?

    Thanks

  9. #9
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Help with a VBA condition

    Don,

    Cut and paste the entire macro above. There was an 'Else' that previously not red, that you probably omitted.

  10. #10
    Registered User
    Join Date
    06-28-2015
    Location
    England
    MS-Off Ver
    2013
    Posts
    39

    Re: Help with a VBA condition

    Hi

    I meant the question about how I can create a command button to go to the next tab on a MultiPage user Form? It is the code I am struggling with as I cannot reference the tab for some reason.

  11. #11
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Help with a VBA condition

    Also - A bit off topic but do you know how I can create a command button to go to the next tab on a MultiPage user Form?
    You should probably just start a new thread.

  12. #12
    Registered User
    Join Date
    06-28-2015
    Location
    England
    MS-Off Ver
    2013
    Posts
    39

    Re: Help with a VBA condition

    Thanks. Already have.

+ 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. Replies: 7
    Last Post: 06-01-2015, 06:05 PM
  2. Condition formatting of multiple condition formatted cells
    By merrin84 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 02-22-2015, 05:08 PM
  3. [SOLVED] Help for if condition formula result only either hit or miss from mulitple condition
    By breadwinner in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-09-2013, 07:29 AM
  4. Replies: 6
    Last Post: 05-06-2010, 10:06 PM
  5. multi condition format? lookup and date condition valid for.
    By D_Rennie in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-13-2009, 11:37 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