Consulting

Results 1 to 7 of 7

Thread: How to add an Pop-up message

  1. #1

    How to add an Pop-up message

    Hi

    I'm trying to create an holiday tracker spreadsheet. But I'm stuck as I need to create a pop-up box warning the Manager that he has got two people on a rest day. When he tries and allow a another person to have the same day off - in a Core area.

    The core areas are:

    FLT
    Admin
    Reciever
    Operative
    Despatch

    I'm using Excel 2010

    I have attached an example of the spreadsheet.


    Thanks

    Kris
    Attached Files Attached Files

  2. #2
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    hi.

    which action will trigger the warning?
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  3. #3
    By input a RD (for Rest Day) or an 1 or 0.5 (holidays) and 1E or 0.5E (for emergency holidays)

  4. #4
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    so they (RD, 1, 0.5, 1E, 0.5E) are all identical when raising a warning or only RDs count?
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  5. #5
    What should happen, is the following

    Fred is on a rest day
    John is on the same rest day as Fred
    Joe wants the same day off as Fred and John - a pop-up should appear to say that there are two people on a rest day in a specific area.

    Fred is on holiday
    John is also on holiday
    Joe wants the same day off as Fred and John - a pop-up should appear to say that there are two people on holiday in a specific area.

    Fred is on holiday
    John is also on holiday
    Joe wants the an (emergency) day off as Fred and John - a pop-up should appear to say that there are two people on holiday in a specific area.

  6. #6
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    I am not available until friday. Members please feel free to reply the thread.

    Btw, i understand, any entry under employee name is a holiday. What is important is whether the employee is in core area. I guess, at least...
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  7. #7
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    I'd probably start with something like this


    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim rEmployees As Range, rRow As Range
        Dim iCol As Long, iMaxCol As Long
        Dim iRest As Long, iHoliday As Long, iEmergency As Long
        Dim sMsg As String
        
        Set rEmployees = Me.Cells(1, 1).CurrentRegion
        
        iMaxCol = rEmployees.Columns.Count
        
        If Intersect(rEmployees, Target) Is Nothing Then Exit Sub
        
        Set rEmployees = Intersect(rEmployees, Target)
        
        For Each rRow In rEmployees.Rows
        
            With rRow.EntireRow
                iRest = 0
                iHoliday = 0
                iEmergency = 0
            
                For iCol = 2 To iMaxCol
                    If .Cells(iCol).Value Like "RD" Then
                        iRest = iRest + 1
                    ElseIf Right(.Cells(iCol).Value, 1) Like "E" Then
                        iEmergency = iEmergency + 1
                    ElseIf .Cells(iCol).Value = 1 Or .Cells(iCol).Value = 0.5 Then
                        iHoliday = iHoliday + 1
                    End If
                Next iCol
                
                If iRest > 1 Then
                    sMsg = "Rest Days:" & vbCrLf & vbCrLf
                    sMsg = sMsg & "    " & iRest & " Employees have Rest Days on the " & .Cells(1).Value
                    Call MsgBox(sMsg, vbCritical + vbOKOnly, "Day Checker")
                End If
                If iHoliday > 1 Then
                    sMsg = "Holidays:" & vbCrLf & vbCrLf
                    sMsg = sMsg & "    " & iHoliday & " Employees have Holidays on the " & .Cells(1).Value
                    Call MsgBox(sMsg, vbCritical + vbOKOnly, "Day Checker")
                End If
                If iEmergency > 1 Then
                    sMsg = "Emergency Days:" & vbCrLf & vbCrLf
                    sMsg = sMsg & "    " & iEmergency & " Employees have Emergency Days on the " & .Cells(1).Value
                    Call MsgBox(sMsg, vbCritical + vbOKOnly, "Day Checker")
                End If
            End With
        Next
    End Sub
    Attached Files Attached Files
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Posting Permissions

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