Results 1 to 4 of 4

Thread: next 7 day birthday list

  1. #1
    Junior Member
    Join Date
    Jul 12
    Posts
    29

    next 7 day birthday list

    In below code i get day wise birthday.. now i need 7 day birthday list in pop



    Private Sub Workbook_Open()
    Dim ws As Worksheet
    Dim rng As Range
    Dim lRow As Long, i As Long
    Dim msg As String

    Set ws = Sheet1

    msg = "Name/DOB"

    With ws
    lRow = .Range("D" & .Rows.Count).End(xlUp).Row

    For i = 2 To lRow

    If Format(.Range("E" & i).Value, "DD/MM") = Format(Now, "DD/MM") Then _
    msg = msg & vbNewLine & .Range("C" & i).Value & "(" & .Range("B" & i).Value & ")"


    If Format(.Range("E" & i).Value, "DD/MM") = Format(Now, "DD/MM") Then _
    msg = msg & vbNewLine & .Range("D" & i).Value & "(" & .Range("E" & i).Value & ")"

    If Format(.Range("H" & i).Value, "DD/MM") = Format(Now, "DD/MM") Then _
    msg = msg & vbNewLine & .Range("G" & i).Value & "(" & .Range("H" & i).Value & ")"
    Next

    MsgBox msg
    End With
    End Sub

  2. #2
    PowerPoster
    Join Date
    Dec 04
    Posts
    18,522

    Re: next 7 day birthday list

    you can try like
    vb Code:
    1. if DateSerial(year(now),month(range("d4")),day(range("d4"))) < date+7 then
    change range to suit
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3
    Junior Member
    Join Date
    Jul 12
    Posts
    29

    Re: next 7 day birthday list

    did't work can u explain in my code...

  4. #4
    Junior Member
    Join Date
    Jul 12
    Posts
    29

    Re: next 7 day birthday list

    please can u help me for that

Posting Permissions

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