A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hi,
Text boxes return text and not dates so in your code both B10 would be a text value and not a date as well as the problems with B11. Try it this way.
Private Sub CheckBoxTodaysDate_Click()
TextBoxDay.Text = Format(Date, "dd/mm/yyyy")
TextBoxDay.Text = Format(DateValue(TextBoxDay.Text), "dd/mm/yyyy")
If CheckBoxTodaysDate = True Then
TextBoxDay.Locked = True
Else
TextBoxDay.Locked = False
End If
WorkingDay = TextBoxDay
' Test WorkingDay
With Range("B10")
.NumberFormat = "DD/MM/YYYY"
.Value = CDate(TextBoxDay)
End With
With Range("B11")
.NumberFormat = "DD/MM/YYYY"
.Value = CDate(WorkingDay)
End With
End Sub