+ Reply to Thread
Results 1 to 7 of 7

vba message box if yes/no

  1. #1
    Forum Contributor
    Join Date
    06-14-2013
    Location
    jk
    MS-Off Ver
    Excel 2007
    Posts
    326

    vba message box if yes/no

    Hi,

    I'm feeling pretty stupid now. I use this macro in another workbook and it works fine, but in the workbook im now working in it gives the error: Compile error, Else without If.

    * "mappingfromfirstfile" is a macro
    Whenever "No" is clicked, it just doesn't have to do anything.


    Please Login or Register  to view this content.
    someone knows what im doing wrong?
    Last edited by Crispy85; 06-25-2015 at 05:57 AM. Reason: took away wrong info

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: vba message box if yes/no

    Try this -

    Please Login or Register  to view this content.
    Cheers!
    Deep Dave

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: vba message box if yes/no

    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    06-14-2013
    Location
    jk
    MS-Off Ver
    Excel 2007
    Posts
    326

    Re: vba message box if yes/no

    Yes! Cool,

    Do you mean that position really was the problem?

  5. #5
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: vba message box if yes/no

    Quote Originally Posted by Crispy85 View Post
    someone knows what im doing wrong?
    If you write the If statement like this, If answer = vbYes Then mappingfromfirstfile, (Single Line Syntax) it does not require End If, and hence its giving that error.

    If you are going to use If with End If, then you should have If answer = vbYes Then on Line 1 & mappingfromfirstfile on Line 2..

    Hope this helps..

  6. #6
    Forum Contributor
    Join Date
    06-14-2013
    Location
    jk
    MS-Off Ver
    Excel 2007
    Posts
    326

    Re: vba message box if yes/no

    Ok thanks for the clarification!

    Regards,
    Crispy

  7. #7
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: vba message box if yes/no

    Please mark the thread as solved if you have your answer..

+ 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. Adding an input message to each cell to bring back corrsponding message
    By Nic31 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-01-2014, 09:28 AM
  2. [SOLVED] How to pop up a warning message before any Excel automatic update link reminder message
    By billj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2013, 10:41 AM
  3. Extracting mail message(outlook) table in the message body
    By andywsw in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-12-2012, 10:14 PM
  4. need of pop up message dynamically using data validation input message method
    By vba_life in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-09-2010, 09:03 AM
  5. [SOLVED] Intercept/replace standard 'cell protected' message with my own message?
    By KR in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-16-2006, 10:35 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