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

Thread: Msgbox if cell contains text

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

    Default

    If cell F3 contains text I want a message box run, I can do this with a number but having problems if cell contains text.

  2. #2
    Board Regular
    Join Date
    Feb 2002
    Location
    Where the wild roses grow
    Posts
    285
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default


    Try:

    If worksheets("sheetname").range("f3").value = "text" then
    msgbox...

    Audiojoe

  3. #3
    New Member
    Join Date
    Apr 2002
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Not quite what I meant, cell F3 could contain any text not "text" the word. Basically if cell F3 contains any word I want a message box to run.

  4. #4
    Board Regular
    Join Date
    Feb 2002
    Location
    Where the wild roses grow
    Posts
    285
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Here you go:

    Private Sub Worksheet_Change(ByVal Target As Excel.Range)

    If Worksheets("sheet1").Range("f3").Value = "" Then
    Exit Sub
    Else
    MsgBox ("An entry has been made")
    End If

    End Sub

    Audiojoe


    [ This Message was edited by: Audiojoe on 2002-04-24 02:42 ]

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

    Default

    Many Thanks sorted out the problem now. I had the extra problem that F3 cell was merged with G3 & H3 so I had to call the range as well.

    Works perfectly now Thank you

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
  •