|
-
Jul 27th, 2012, 11:14 PM
#1
Thread Starter
Junior Member
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
-
Jul 28th, 2012, 01:01 AM
#2
Re: next 7 day birthday list
you can try like
vb Code:
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
-
Jul 28th, 2012, 01:49 AM
#3
Thread Starter
Junior Member
Re: next 7 day birthday list
did't work can u explain in my code...
-
Aug 17th, 2012, 12:15 AM
#4
Thread Starter
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|