Not sure if this is the problem, but I don't think any of your cells actually equal 0/1/1900. The Excel interpretation of the number zero in a cell formatted as date would be 0/1/1900 (or 1/0/1900 in U.S. English versions of Excel).
Perhaps the SQL field you're getting your data from is a date field, but it is empty and returning a 0 instead of a null value? I'm not an expert in SQL by any means, but it seems logical.
Try testing for 0 instead of 0/1/1900, like so..
Sub Populate_Cells()
If Range("Sheet2!CW6") <> 0 Then
Range("N6").Value = Range("Sheet2!CW6")
ElseIf Range("Sheet2!CS6") <> 0 Then
Range("N6").Value = Range("Sheet2!CS6")
ElseIf Range("Sheet2!AK6") <> 0 Then
Range("N6").Value = Range("Sheet2!AK6")
ElseIf Range("Sheet2!AG6") <> 0 Then
Range("N6").Value = Range("Sheet2!AG6")
Else
Range("N6").Value = Range("Sheet2!AG6")
End If
End Sub
UPDATE: Upon further review, you're using quotes around the first instance of Range("Sheet2!..."), but you don't use quotes for any of the other ranges. Try adding the quotes to each of the Range statements as shown in red above.
Bookmarks