Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 8 of 8

Thread: Msg Box by selecting cell

  1. #1
    New Member
    Join Date
    May 2002
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Is it possible to have a Msg Box popped up by just selecting a cell? That is, can Excel be so programmed that as I select cell A1, a Msg Box pops up with a message?


  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    Sydney/Brisbane , Australia
    Posts
    542
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    What is the reason for you wanting the message box to cokme up when they click a cell?

    you may find the users in here can give you a better solution if you tell us why you want to do it this difficult way?

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Posts
    363
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Right click on the sheet tab. Click View Code. This will launch the VBA editor with the following:
    Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

    End Sub

    add the following code after the first line:

    If ActiveCell.Address = "$A$1" Then
    MsgBox "Your message here"
    End If
    It's never too late to learn something new.

    Ricky

  4. #4
    MrExcel MVP Mark O'Brien's Avatar
    Join Date
    Feb 2002
    Location
    Columbus, OH, USA
    Posts
    3,530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Yeah, right click on the name tab of the sheet that you want the messagebox to appear on when "A1" is selected, choose "View Code" and stick in this code:


    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Count > 1 Then Exit Sub
    If Target = Me.Range("A1") Then
    MsgBox "Hi"
    End If
    End Sub


    As for getting the messagebox to appear right next to the cell, that isn't going to happen. A comment is probably going to be your best bet. (there's another text box thingy, but I can't remember how to insert that)

  5. #5
    New Member
    Join Date
    May 2002
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks guys....this worked beautifully.

  6. #6
    MrExcel MVP
    Join Date
    Apr 2002
    Location
    Vancouver BC , Canada
    Posts
    6,259
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    If you don't want to get into coding you can also get a pop-up input message by using the "Data"..."validation"..."input message" option from the tool bar.

  7. #7
    Board Regular
    Join Date
    Feb 2002
    Location
    Huntington Beach, CA USA
    Posts
    327
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hey cruzzin, "cruzzinn for a bruzzin"

    easy on the freudian slip, cokme?
    as i figured!


    James

  8. #8
    Board Regular
    Join Date
    Mar 2002
    Location
    Sydney/Brisbane , Australia
    Posts
    542
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    huh?

Some videos you may like

User Tag List

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
  •