Convertir Fecha Normal a Juliana y Viceversa en VBA Excel
Código UDF Function Fecha·Normal·a·Juliana·Viceversa(ByVal Fecha As Variant, Optional Ingrese·1·para·Juliana·a·Normal As Boolean = False) As Variant Dim A As Integer, D As Integer, FN As Date If Ingrese·1·para·Juliana·a·Normal Then A = Left(Fecha, 4) D = Right(Fecha, Len(Fecha) - 4) On Error Resume Next FN = DateSerial(A, 1, D) On Error GoTo 0 If IsDate(FN) Then Fecha·Normal·a·Juliana·Viceversa = FN Else Fecha·Normal·a·Juliana·Viceversa = CVErr(xlErrValue) End If Else If IsDate(Fecha) Then A = Year(Fecha) D = Fecha - DateSerial(A, 1, 0) Fecha·Normal·a·Juliana·Viceversa = A & Format(D, "000") Else Fecha·Normal·a·Juliana·Viceversa = CVErr(xlErrValue) End If End If End Function Código Procedimiento Sub Convertir·Fecha·Normal·a·Juliana·Viceversa() Dim RE As Range, RS As Range, C As Range, F As Variant, M As Variant, A As Integer, D As Integer, FN As Date, R As Variant On Error Resume Next Set RE = Application.InputBox("Seleccione el rango que contiene las Fechas Normales