Again, upload a sample workbook -- not knowing the context of the data does not help in interpreting your code.
Observations:
1. Do not see any "Intermediate Step" -- Formula given in earlier post will work.....
2. Statement Do Until IsEmpty(Range("A3:A").Offset(i,0) Your incremental is never increased. In fact you are reusing the counter in your for loop "For i=0 to 9" This is bad coding practice.... in fact after your first run where i = 0 , then is stays 9 for an end less loop inside the Do statement
3. Your VBA code does not convert Julian Dates
Not knowing your structure the code would look something like this: I have attatched a workbook with the code as well as doing the same using formulas....
JulianDates.xlsm
Sub ConvertJulianDates()
Dim i As Integer
Dim r As Range
Dim JulianDate As Long
Dim SerialDate As Date
Dim JR As Long
Set r = Range("A3")
i = 0 'Starting Counter
Do Until IsEmpty(r.Offset(i, 0).Value)
JulianDate = Val(r.Offset(i, 0).Value)
If Left(JulianDate, 2) < 30 Then
JR = 2000
Else
JR = 1900
End If
SerialDate = DateSerial(JR + Int(JulianDate / 1000), 1, JulianDate Mod 1000)
r.Offset(i, 1).Value = Year(SerialDate)
r.Offset(i, 2).Value = Month(SerialDate)
r.Offset(i, 3).Value = Day(SerialDate)
i = i + 1
Loop
End Sub
Bookmarks