Consulting

Results 1 to 1 of 1

Thread: How to pop up message box even when editing a cell

  1. #1
    VBAX Mentor
    Joined
    Nov 2020
    Location
    Cochin, Kerala
    Posts
    314
    Location

    How to pop up message box even when editing a cell

    Hi Experts,
    The following on time message is not popping up if the user is editing a cell. How can I run the codes even if the user is editing a cell (probably a formula) without loosing the cell value/formula.
    Private Sub Workbook_Open()
    Application.Run "OnTime"    
    End Sub
    
    
    Sub OnTime()    
    Application.OnTime Now + TimeValue("00:10:00"), "MyMacro1"
    End Sub
    
    
    Sub MyMacro1()
        UName = Split(Environ("UserName"), ".")
        UName = UName(0)
         MsgBox "Hi " & UName & vbNewLine & "You have 20 minutes left to complete the tests, workbook will automatically close in 20 Minutes."
        Application.OnTime Now + TimeValue("00:10:00"), "MyMacro2"
    End Sub
    
    
    Sub MyMacro2()
        MsgBox "Hi " & UName & vbNewLine & "You have 10 minutes left to complete the tests, workbook will automatically close in 10 Minutes."
        Application.OnTime Now + TimeValue("00:10:00"), "CloseMacro"
    End Sub
    
    
    Sub CloseMacro()
        ActiveWorkbook.Save
        ActiveWorkbook.Close
    End Sub
    Thanks in advance!
    Last edited by anish.ms; 09-17-2021 at 12:50 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •