+ Reply to Thread
Results 1 to 2 of 2

"If statement" launching MsgBox

  1. #1
    Registered User
    Join Date
    03-03-2005
    Posts
    1

    "If statement" launching MsgBox

    Appreciate if anyone can suggest how to use an If statement formula where the true condition would launch a MsgBox macro. (Its for an excel sheet linked to live stock quotes, and I want to have an alert for when the price in the linked cell reaches a certain level)

  2. #2
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Try this

    You can adapt this to what you need, this will cause the message box to pop up when the value £1.50 is entered in cell A1 or if by suming the value of A1 reaches £1.50. Paste this code in to the code page for the worksheet you want it to work on.

    Hope this is what you wanted as you were a little sketchy!

    Simon

    Public Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Range("A1").Text <> "£1.50" Then
    ElseIf Range("A1").Text = "£1.50" Then
    MsgBox "Price is matched at" & Range("A1").Text
    End If
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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