+ Reply to Thread
Results 1 to 10 of 10

Display message based on value using VBA

  1. #1
    Forum Contributor
    Join Date
    07-04-2018
    Location
    Dallas
    MS-Off Ver
    MS 365 Version 2302
    Posts
    231

    Display message based on value using VBA

    Hello,

    I have a cell in excel which has drop down of Yes and No.

    Based on the value selected, I need to display message using VBA.

    I tried the below code but it does not display any message in excel.

    Can anyone please suggest what is missing in the code. Thanks in advance.

    Please Login or Register  to view this content.
    Last edited by BMD4; 02-16-2023 at 12:02 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,719

    Re: Display message based on value using VBA

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. 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, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, 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

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: Display message based on value using VBA

    Try this instead
    Please Login or Register  to view this content.
    @alansidman - Sorry I posted this before I saw your note at the bottom, if you need to remove this until the OP fixes the codes tags, feel free.
    Attached Files Attached Files
    Last edited by NewYears1978; 02-16-2023 at 02:46 AM.

  4. #4
    Forum Contributor
    Join Date
    07-04-2018
    Location
    Dallas
    MS-Off Ver
    MS 365 Version 2302
    Posts
    231

    Re: Display message based on value using VBA

    Thank you.

    I tried the same but it doesn't seem to work. Attached the file.

  5. #5
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,651

    Re: Display message based on value using VBA

    Quote Originally Posted by BMD4 View Post
    Thank you.
    I tried the same but it doesn't seem to work. Attached the file.
    Hi, try to come back your 1st post, to edit as per requested in #2.
    (If not, I will not tell you to make sure you want to trigger any change in cell C2 ONLY)
    Quang PT

  6. #6
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: Display message based on value using VBA

    Quote Originally Posted by BMD4 View Post
    Thank you.

    I tried the same but it doesn't seem to work. Attached the file.
    There was no file attached. Also you still need to correct your code in your first post. You need to put code tags around the code you can do that with the # button in the toolbar or you can just type them like [ code ] before the code and [ /code ] after the code, but without the spaces.
    My posted code works, but as bebo said, assuming the dropdown is in C2 and that code only checks there Please reupload your sample so we can check it. You did not attach it, you have to pick the file, then click upload, then close that window (it's confusing the first time you use it hehe)

    Also, you need to make sure you are putting that code in the sheet code section, not the workbook or module. (right click on the sheet tab and click edit code, make sure the code is in there)

  7. #7
    Forum Contributor
    Join Date
    07-04-2018
    Location
    Dallas
    MS-Off Ver
    MS 365 Version 2302
    Posts
    231

    Re: Display message based on value using VBA

    Hello, I have updated the code format in the first post.

    Also, my file is working now. Thank you!

  8. #8
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: Display message based on value using VBA

    Quote Originally Posted by BMD4 View Post
    Hello, I have updated the code format in the first post.

    Also, my file is working now. Thank you!
    Great what fixed it?

  9. #9
    Forum Contributor
    Join Date
    07-04-2018
    Location
    Dallas
    MS-Off Ver
    MS 365 Version 2302
    Posts
    231

    Re: Display message based on value using VBA

    Hello,

    The file provided by you worked. I missed syntax when I initially tried it. Thanks again.

  10. #10
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: Display message based on value using VBA

    Oh, okay great

+ 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. Macro - VBA - to display message based on condition
    By umeshbanga in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-15-2019, 06:11 AM
  2. [SOLVED] Display message based on multiple criteria..
    By smartin5 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-12-2014, 01:07 PM
  3. [SOLVED] Display Warning Message based on dates
    By Will_iam in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-18-2012, 10:26 AM
  4. Display a message based on time
    By LisaPatch in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-24-2011, 10:11 AM
  5. Display an error message based on particular condition
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-30-2009, 05:53 AM
  6. How to display a pop message based on a cell value
    By ashvik in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-11-2006, 11:05 AM
  7. [SOLVED] Display message based on condition
    By Pat in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-07-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