Power Query Course in Spanish
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 7 of 7

Thread: Message Box Prompt

  1. #1
    Guest

    Default

    I'd like to create the following situation (VBA)

    I have a cell (C4) that is calculated based on values contained in other cells. What I would like is to have a message box appear when the value in C4 exceeds 10,000. Any suggestions? Thanks!

  2. #2
    Board Regular
    Join Date
    Feb 2002
    Location
    Calgary Canada
    Posts
    222
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    hi,
    put this code in the sheet:
    ''''''''''''''''''''''
    Private Sub Worksheet_Change(ByVal Target As Range)
    If ActiveSheet.Range("C4").Value > 10000 Then MsgBox "The value in C4 exceeds 10,000"
    End Sub

    '''''''''''''''''''''''''''''''''''''''''
    good luck

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    Calgary Canada
    Posts
    222
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    or try:
    '''''''''''''''''''''''
    Private Sub Worksheet_Change(ByVal Target As Range)

    If Sheets(Sheet_Name).Range("C4").Value > 10000 Then MsgBox "The value in C4 exceeds 10,000"
    End Sub
    ''''''''''''''''''''''''''''''
    where Sheet_Name is the sheet that contains the C4.
    Good luck
    Hamid

  4. #4
    Guest

    Default

    Hmmm...I have tried both, with no luck. Do I put this in the sheet or as a module. Also, the cell (C4) that I need to determine the prompt is calculated based on the addition of two other cells, so I'm not sure if this is the problem. Or maybe there are additional steps the the code you offered that I have not entered? Any sugggestions? Thanks again!

  5. #5
    Board Regular
    Join Date
    Feb 2002
    Location
    Calgary Canada
    Posts
    222
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    please put these code in "SheetChange" event for "Workbook" object:
    ''''''''''''''''''''''
    Sheet_Name = "Sheet1"
    If Sheets(Sheet_Name).Range("C4").Value > 10000 Then MsgBox "The value in C4 exceeds 10,000"
    '''''''''''''''''''''''''''''''''''
    also no problem about C4.

    Hamid

  6. #6
    Guest

    Default

    I apologize for my ignorance, but I am still having trouble! I'm not really sure what the following means:

    please put these code in "SheetChange" event for "Workbook" object:

    Can you explain this in more detail? I really appreciate your help!

  7. #7
    Board Regular
    Join Date
    Feb 2002
    Location
    Calgary Canada
    Posts
    222
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    may be it is my fault. I am not good in English. anyway,
    in VBA:
    from "VBAProject" window choose "microsoft Excel Objects" folder.
    from this folder choose "thisworkbook" object.
    now paste this code:
    '''''''''''''''
    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    Sheet_Name = "Sheet1"
    If Sheets(Sheet_Name).Range("C4").Value > 10000 Then MsgBox "The value in C4 exceeds 10,000"

    End Sub
    '''''''''''''''''''''
    if I have your Email address, I can send the program.
    hshahbaazi@chem.susc.ac.ir
    best wishes
    Hamid

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
  •