+ Reply to Thread
Results 1 to 13 of 13

Macro for a Pop-Up Box help....

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-21-2006
    Location
    Sheffield, England
    MS-Off Ver
    Excel 2007
    Posts
    108

    Macro for a Pop-Up Box help....

    Hi. I hope someone can help me.....

    I have a spreadsheet which is used for a daily schedule of contact centre advisor staff. I want to create a macro that will throw up a pop up box when the sheet is opened using the date as a reference....

    So on e worksheet named 'realtime' i have row 2 from cells B to AZ containing a date ie B2= 01/07/2007, C2= 02/07/2007 etc.

    Column A has various 'headings' A4= Earlies, A5= Mids, A6= Lates, A7= Total

    So under each date is the corresponding figures for the stuff in column A.

    So if I open the sheet today (03/07/2007) I would want a pop up that shows this data....

    Earlies + the data in D4
    Mids + the data in D5
    Lates + the data in D6
    Total + the data in D7

    But obviously it needs to reference today's date and show the figures under that date?

    Hope this makes sense.

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    See the attached file.

    I hope it's what you need.

    Regards,
    Antonio
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Hi, Neil. See if this will work for you. Copy this procedure into the ThisWorkbook module of your workbook:
    Private Sub Workbook_Open()
        Dim Rng As Range, dRng As Range, msg As String, i As Integer
        
        Set Rng = Worksheets("realtime").Range("B2:AZ2")
        
        Set dRng = Rng.Find(Date)
        
        If dRng Is Nothing Then
            MsgBox "Today's date not found."
            Exit Sub
        End If
        
        For i = 1 To 4
            msg = msg & Cells(i + 3, 1) & "  " & dRng.Offset(i) & vbCrLf
        Next i
        
        MsgBox msg, , Format(Date, "d/m/yyyy")
    End Sub
    HTH

    Jason

  4. #4
    Forum Contributor
    Join Date
    06-21-2006
    Location
    Sheffield, England
    MS-Off Ver
    Excel 2007
    Posts
    108
    Hi Jason, yours seems to work, but it is saying it cannot find the date. Does the date need to be specified anywhere? Or should it take it from the system?

  5. #5
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Are the dates listed in B2:AZ2? If so, are they actual dates, or text strings? The variable 'Date' does not need to be defined; it is similar to the TODAY() worksheet function.

  6. #6
    Forum Contributor
    Join Date
    06-21-2006
    Location
    Sheffield, England
    MS-Off Ver
    Excel 2007
    Posts
    108
    Yes, sorry that does work.... However I need it to show the wording in Column A?

    So it should read

    Earlies: 3
    Mid: 6
    Lates: 3
    Total: 12

  7. #7
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    It should show the contents of cells A4:A7 before each of the amounts. Is this the correct range?

+ 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