Power Query Course in Spanish
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Message box when cell contains specific text VBA

  1. #1
    New Member
    Join Date
    Feb 2018
    Posts
    25
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Message box when cell contains specific text VBA

    I'm still very new to VBA and learning. Hopefully this is a simple request. I need a VBA that when my cell K8 contains FALSE a message box will pop up. I can not seem to find the right way to trigger the message box. Can anybody help?

  2. #2
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    11,369
    Post Thanks / Like
    Mentioned
    216 Post(s)
    Tagged
    14 Thread(s)

    Default Re: Message box when cell contains specific text VBA

    How is K8 being filled?
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 2003 & 2013 on Win 7

  3. #3
    New Member
    Join Date
    Feb 2018
    Posts
    25
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Message box when cell contains specific text VBA

    Also I suppose there might be another way but I'm less confident in this one. The reason my cell K8 would read FALSE is because its linked to a check box. So another way would be when the check box is unchecked the message box would appear.

  4. #4
    New Member
    Join Date
    Feb 2018
    Posts
    25
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Message box when cell contains specific text VBA

    Quote Originally Posted by Fluff View Post
    How is K8 being filled?
    We must have been replying at the same time. As you can see in my reply it is filled by the checkbox.

  5. #5
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    11,369
    Post Thanks / Like
    Mentioned
    216 Post(s)
    Tagged
    14 Thread(s)

    Default Re: Message box when cell contains specific text VBA

    How about
    Code:
    Sub CboxClick()
    If ActiveSheet.CheckBoxes(Application.Caller) < 0 Then MsgBox "false"
    End Sub
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 2003 & 2013 on Win 7

  6. #6
    New Member
    Join Date
    Feb 2018
    Posts
    25
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Message box when cell contains specific text VBA

    A little more info. I have a checkbox placed over K8 and linked to it also. When the box is checked through conditional formatting it changes K8 green and also the text in K8 to green so as to hide the word TRUE. Same thing happens when unchecked but with red text and box fill. It will be an indicator on the sheet for safety issues in the shop. The message box will be a reminder that when red is seen to make sure and notify the safety department. Thanks.

  7. #7
    New Member
    Join Date
    Feb 2018
    Posts
    25
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Message box when cell contains specific text VBA

    Quote Originally Posted by Fluff View Post
    How about
    Code:
    Sub CboxClick()
    If ActiveSheet.CheckBoxes(Application.Caller) < 0 Then MsgBox "false"
    End Sub
    It's still not bringing up the message box. I tried putting it in this worksheet, and a new module neither worked.

  8. #8
    New Member
    Join Date
    Feb 2018
    Posts
    25
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Message box when cell contains specific text VBA

    *this workbook not worksheet.

  9. #9
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    11,369
    Post Thanks / Like
    Mentioned
    216 Post(s)
    Tagged
    14 Thread(s)

    Default Re: Message box when cell contains specific text VBA

    It needs to go in a standard module, Then right click the checkbox & assign macro, select the macro from the list.
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 2003 & 2013 on Win 7

  10. #10
    New Member
    Join Date
    Feb 2018
    Posts
    25
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Message box when cell contains specific text VBA

    Quote Originally Posted by Fluff View Post
    It needs to go in a standard module, Then right click the checkbox & assign macro, select the macro from the list.
    Works like a charm now!!! Thank you very much!

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •