Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello All!
*Excel 2003* I have a 2 bits of code I coppied from Chip Pearsons Website that changes my Julian dates to Gregorian dates and back again. I have a Worksheet that I would like to use this code on but I would like it to look at 2 columns ("D" and "I") that contain Julian dates ie.(04354) formatted as text and run this function on the entire Used Range of both columns (minus the Header row). As the functions loop through the ranges I want to replace the old Julian values with the new Gregorian values. I will then run some proceedures that include the Gregorian Dates and after I am finished I wish to return them to their previous Julian Dates. Basiclly I want the ability to toggle these date formats back and forth from within other proceedures. Can anyone assist me with this code? My julian date functions are posted below. Function JDateToGDate1(JDate As String) As Long Dim TheYear As Integer Dim TheDay As Integer Dim GDate As Long TheYear = CInt(Left(JDate, 2)) If TheYear < 30 Then TheYear = TheYear + 2000 Else TheYear = TheYear + 1900 End If TheDay = CInt(Right(JDate, 3)) GDate = DateSerial(TheYear, 1, TheDay) JDateToGDate1 = GDate End Function '************** And************** Function GDateToJDate1(GDate As Long) As String Dim TheYear As Integer Dim TheDays As Integer Dim JDate As String TheYear = Year(GDate) TheDays = DateDiff("d", DateSerial(TheYear, 1, 0), GDate) JDate = Right(Format(TheYear, "0000"), 2) & Format(TheDays, "000") GDateToJDate1 = JDate End Function Thanks in advance for your assistance, -- Patrick |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
JULIAN DATES? | Excel Worksheet Functions | |||
dates format using gregorian and hijri calendars | Excel Discussion (Misc queries) | |||
Converting Julian Dates to regular dates | Excel Worksheet Functions | |||
Julian dates | Excel Discussion (Misc queries) | |||
julian dates | Excel Discussion (Misc queries) |