+ Reply to Thread
Results 1 to 6 of 6

Syntax error on msgbox

  1. #1
    Forum Contributor
    Join Date
    12-15-2009
    Location
    Herndon, VA
    MS-Off Ver
    Excel 2010
    Posts
    163

    Syntax error on msgbox

    I am getting syntax errors on the msgbox lines. I think this has something to do with the prompt text continuing to a second line.

    Should the end of the first line have a space before or after the underscore or both or does it not matter?


    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  2. #2
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Syntax error on msgbox

    You must concatenate:
    Please Login or Register  to view this content.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Syntax error on msgbox

    Hello Excel_vba,

    Here is an easier way to validate the entries...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Forum Contributor
    Join Date
    12-15-2009
    Location
    Herndon, VA
    MS-Off Ver
    Excel 2010
    Posts
    163

    Re: Syntax error on msgbox

    Quote Originally Posted by Leith Ross View Post
    Hello Excel_vba,

    Here is an easier way to validate the entries...
    Please Login or Register  to view this content.
    Awesome solution. This saves me the trouble of writing two IFs. I have this macro in the module called "ThisWorkbook" so that the macro runs when the Excel workbook is opened. To test this out, I typed AJJ125 which violates the condition so a message box should have been triggered, but it wasn't triggered.

    How can I get this to trigger when I enter the wrong criteria?

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Syntax error on msgbox

    Hello Excel_vba,

    Copy the macro below.
    Select Sheet1 and right click the tab.
    Click "View Code..."
    Paste using Ctrl V.

    Now, whenever data is input into cell G10, it will be automatically validated.

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    12-15-2009
    Location
    Herndon, VA
    MS-Off Ver
    Excel 2010
    Posts
    163

    Re: Syntax error on msgbox

    Quote Originally Posted by Leith Ross View Post
    Hello Excel_vba,

    Copy the macro below.
    Select Sheet1 and right click the tab.
    Click "View Code..."
    Paste using Ctrl V.

    Now, whenever data is input into cell G10, it will be automatically validated.

    Please Login or Register  to view this content.
    Nice. It worked. Thank you very much. But why did you change your code? Wouldn't the original code work inside of the Worksheet_Change event?

+ 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. Userform Syntax to have textbox display Msgbox when contents left unchanged
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-01-2012, 06:25 AM
  2. VBA msgbox syntax & breaks between boxes
    By mewingkitty in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-18-2009, 10:33 PM
  3. msgbox syntax
    By tryer in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-04-2008, 12:22 PM
  4. syntax for code in MsgBox()?
    By Ouka in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-20-2005, 04:05 PM
  5. [SOLVED] [SOLVED] MsgBox Syntax
    By scott in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-07-2005, 07:06 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