Dandapani S
New Member
Hi all,
I am very new to vba...taking a small step into that. I need to calculate "Ageing" by date as input..... Pls go thru my vba code & fix the error...
Public Function AgeingV(rng As Date) As String
Dim strdate As Date
Dim strReturn As String
Dim diffv As String
strdate = DateValue("January 31,2014")
diffv = DateDiff("d", strdate, rng)
Select Case diffv.Value
Case 0 To 30
strReturn = "0-30"
Case 31 To 60
strReturn = "31-60"
Case 61 To 90
strReturn = "61-90"
Case 91 To 180
strReturn = "91-180"
Case Else
strReturn = ">180"
End Select
AgeingV = strReturn
End Function
I am very new to vba...taking a small step into that. I need to calculate "Ageing" by date as input..... Pls go thru my vba code & fix the error...
Public Function AgeingV(rng As Date) As String
Dim strdate As Date
Dim strReturn As String
Dim diffv As String
strdate = DateValue("January 31,2014")
diffv = DateDiff("d", strdate, rng)
Select Case diffv.Value
Case 0 To 30
strReturn = "0-30"
Case 31 To 60
strReturn = "31-60"
Case 61 To 90
strReturn = "61-90"
Case 91 To 180
strReturn = "91-180"
Case Else
strReturn = ">180"
End Select
AgeingV = strReturn
End Function