# Convert date to week number and year



## Adam19931 (Jan 2, 2023)

Hi all, I have a date in textbox frm.Form.txtDelDate on a user form and I am looking for a way to convert this date to a week number in "ww-yyyy" format with the first day of the week being Sunday. Is there a way of doing this in VBA so that it can be added to irow,2 in the code below please?



```
With sh
    
        .Cells(irow, 1) = "3T-" & irow - 1
        .Cells(irow, 2) =
        .Cells(irow, 3) = [text(Now(),"DD-MM-YYYY")]
        .Cells(irow, 4) = frmForm.txtDelDate.Value
        .Cells(irow, 6) = frmForm.txtDestName.Value
        .Cells(irow, 7) = frmForm.txtDestLocation.Value
        .Cells(irow, 8) = frmForm.txtRouteID.Value
```

Thanks in advance for any help


----------



## Micron (Jan 2, 2023)

perhaps some variation of
= weekday(#01/02/2023#) & "-" & year(#01/02/2023#)

I think I would pass the textbox date to a variable and use that instead of an actual date or instead of repeating the textbox reference.


----------

