Consulting

Results 1 to 12 of 12

Thread: Solved: POP UP MESSAGE

  1. #1
    VBAX Contributor
    Joined
    Dec 2006
    Posts
    193
    Location

    Solved: POP UP MESSAGE

    Could some one please assist me on creating a pop up message. If a collum of cells ( A5:A70) has certain dates in them ,and one of the dates coincides with a public holiday I would like a pop up message to appear naming the specific public holiday if this could be done I would be most thankful.

  2. #2
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location
    Are those dates already present are must they be checked when entered in your range A5:A70 ?

    - if not present use worksheet change and check target.value
    - check target.value against a list of dates in A and comments in B on sheet2
    - if found, msgbox and remove contents of target

    Something like this ?

    Charlize

  3. #3
    VBAX Contributor
    Joined
    Dec 2006
    Posts
    193
    Location
    Charlize the dates are already present

    THKS

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    If you have a table of holidays, dates and names, you can use MATCH and VLOOKUP in code to check the date list against that table.

  5. #5
    Administrator
    Chat VP
    VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    You could also use data validation
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  6. #6
    VBAX Contributor
    Joined
    Dec 2006
    Posts
    193
    Location
    What would the custom code be for data valadation to obtain a pop up message

    Thks

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    DV wouldn't name the holiday, it could only tell you as you enter a date that it is a holiday.

  8. #8
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location
    Try this. Lookup dates are on sheet2. A = date and B = description.
    [vba]Sub Get_Dates()
    Dim Cell As Range
    Dim Search_date As String
    Dim V_message As String
    If ActiveCell.Row < 5 Or ActiveCell.Column > 1 Then Exit Sub
    If ActiveCell.Value = vbNullString Then Exit Sub
    Search_date = Worksheets("Sheet1").Range(ActiveCell.Address).Value
    For Each Cell In Worksheets("Sheet2").Range("A2:A" & _
    Worksheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row)
    If Cell Like "*" & Search_date & "*" Then
    V_message = Search_date & " - " & Cell.Offset(0, 1).Value
    Exit For
    End If
    Next Cell
    If V_message = vbNullString Then
    MsgBox Search_date & " isn't a holiday !", vbCritical, "Watch out !!!"
    Else
    MsgBox V_message, vbInformation, "Requested info ..."
    End If
    End Sub[/vba]Charlize
    Last edited by Charlize; 04-20-2007 at 04:53 AM.

  9. #9
    VBAX Contributor
    Joined
    Dec 2006
    Posts
    193
    Location
    Thanks for the code Charlize, its very cool .One thing extra if you could,what if there is a number of public holidays in the list could the pop up message indicate more than one ?

    Thanks

  10. #10
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location
    This one ?
    [VBA]Sub Get_Dates()
    Dim Cell As Range
    Dim Cell1 As Range
    Dim V_message As String
    For Each Cell1 In Worksheets("Sheet1").Range("A5:A" & _
    Worksheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row)
    'sheet 2 starts at row 2 with dates in column A
    'and description in column B
    For Each Cell In Worksheets("Sheet2").Range("A2:A" & _
    Worksheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row)
    If Cell Like "*" & Cell1.Value & "*" Then
    V_message = V_message & Cell1 & " - " & Cell.Offset(0, 1).Value & vbCrLf
    Exit For
    End If
    Next Cell
    Next Cell1
    If V_message = vbNullString Then
    MsgBox "No holidays in list !", vbInformation, "Holiday check."
    Else
    MsgBox V_message, vbCritical, "Holiday check"
    End If
    End Sub[/VBA]Charlize

  11. #11
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location
    Quote Originally Posted by BENSON
    ... One thing extra if you could,
    if I could ... you can do that to. Just a matter of really want to be able to do this kind of stuff.

    Charlize

  12. #12
    VBAX Contributor
    Joined
    Dec 2006
    Posts
    193
    Location
    THANK YOU SO MUCH ,YOU GUYS ARE GREAT

Posting Permissions

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