jk6686's Profile
Reputation: 0
Apprentice
- Group:
- New Members
- Active Posts:
- 1 (0 per day)
- Joined:
- 09-February 09
- Profile Views:
- 1,060
- Last Active:
Sep 12 2011 03:14 AM- Currently:
- Offline
Previous Fields
- Country:
- IN
- OS Preference:
- Windows
- Favorite Browser:
- FireFox
- Favorite Processor:
- Intel
- Favorite Gaming Platform:
- Who Cares
- Your Car:
- Who Cares
- Dream Kudos:
- 0
Latest Visitors
Posts I've Made
-
In Topic: Does anyone know a VBA code tht will work out a customers age from DoB
Posted 31 Aug 2011
'finding the age in years,months,days from date of birth Dim dtDOB As Date Dim dtAsOf As Date Dim dtBDay As Date Dim M As Integer Dim D As Integer Dim age As Integer Dim varAsOf As Date Dim varDOB As Date Dim slrow As Integer Dim rc As Integer Dim colno As Integer 'here colno is the column no of date of birth For s1row = 2 To RowCount 'here rowcount to be calculated from the sheet where date of birth is taken varDOB = Format(Trim(mastersheet.Cells(s1row, colno).Value), "dd-mmm-yyyy") If IsDate(varDOB) Then dtDOB = varDOB dtAsOf = Date 'calculating today's date If dtAsOf >= dtDOB Then dtBDay = DateSerial(Year(dtAsOf), Month(dtDOB), Day(dtDOB)) Y = DateDiff("yyyy", dtDOB, dtAsOf) M = Month(dtAsOf) - Month(dtDOB) - (12 * (dtBDay > dtAsOf)) D = Day(dtAsOf) - Day(dtDOB) If D < 0 Then M = M - 1 D = Day(DateSerial(Year(dtAsOf), Month(dtAsOf) + 1, 0)) + D + 1 End If End If End If outputbook.Worksheets(Sheet1_Name).Cells(s1row, 4) = Y & " years " & M & " months " & D & " days" 'outputbook is the workbook where age is displayed Next
try this one
My Information
- Member Title:
- New D.I.C Head
- Age:
- 23 years old
- Birthday:
- July 11, 1989
- Gender:
-
- Location:
- Bangalore
- Interests:
- My interests are programming,solving puzzles etc
- Full Name:
- Jashni.K
- Years Programming:
- 3
- Programming Languages:
- C,JAVA,PHP,VBA
Contact Information
- E-mail:
- Click here to e-mail me
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
jk6686 has no profile comments yet. Why not say hello?