If you the sheet with the "AB" column you are looking at is the Active Sheet at the time of running this code, try this:
VBA Code:
If ActiveSheet.Range("AB1") <> "" Then
Sheets("Date").Range("A1").Value = ActiveSheet.Range("AB1").Value
Else
Sheets("Date").Range("A1").Value = ActiveSheet.Range("AB1").End(xlDown).Value
End If
Otherwise, replace the "ActiveSheet" references with the specific sheet name.