+ Reply to Thread
Results 1 to 4 of 4

using an if then statement call a caption box to a cell

  1. #1
    Registered User
    Join Date
    06-14-2005
    Posts
    13

    Question using an if then statement call a caption box to a cell

    In my excel project, I have a cell that performs a sum function. an associated goal is tied to that cell and consequently the results...I want to develop an if then statement that upon reaching the goal, a caption, lable, or text box (msgbox) will appear and give a message to the user...how is this possible?

    tks ahead of time

    ratt out

  2. #2
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    Well, you could simply say...

    If Range("A1") = 100 then
    MsgBox("Goal value reached")
    End If

    Assuming that 100 is the goal value you are seeking.


    Mangesh

  3. #3
    Registered User
    Join Date
    06-14-2005
    Posts
    13

    Cool tks, but

    do you use a control to put it in or do you put it directly tin to the code...do you dim ianything in the code or do you simply put it in the cell like you would a formula?

    tks

  4. #4
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    Hi,

    Since you posted this in the programming section, and since you had not given any more details....

    Assuming that you enter your input in cells A1 and A2, And cell B2 is the one which you want to check, you could have enter the following code in the module of the concerned sheet. Right click on the tab which holds the sheet name, click view code, and enter the following code:


    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$A$1" Or Target.Address = "$A$2" Then
    If Range("B2") >= 100 Then
    MsgBox ("Goal value reached")
    End If
    End If
    End Sub


    Mangesh

+ 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