I've spent some time looking on SO for an answer but cannot find it.
I have a spreadsheet with contact details on it.
I have a VBA macro that extracts the data for a contact from the spreadsheet and presents it on a userform in a series of textboxes so that it can be checked and updated. One of the columns contains a date. The code used it is:
.tb21 = Format$(Cells(intRowUID, 21).Value, "dd/mm/yyyy")
When the user clicks [OK] the code that writes it back to the spreadsheet is:
Cells(intRowUID, 21).NumberFormat = "dd/mm/yyyy"
Cells(intRowUID, 21) = Format(.tb21.Value, "dd/mm/yyyy")
This appears to work but when I go the spreadsheet and try to filter on the date Excel does not recognised it as a date and it is shown on the filter dropdown at the bottom as what appears to be text.
If I click on the formula bar and then click on the [tick] excel then recognises it as a date and the filter works OK.
The cell is formatted as a date as "dd/mm/yyyy".
How can I make Excel recognise the date?