Excel: Run-Time Error '13' Type Mismatch
What could be the reason, that I get the the Run-Time Error '13' Type Mismatch with this line of VBA开发者_如何学Python Code:
.Cells(1, 1) = CDate(Format(Now, "dd.mm.yy hh:mm"))
The problem is, that a colleague doesn't get this error. We have both a "German" office.
I'm not sure why you need the format, since its just being turned straight back into a Date before you fill the cell.
You should really either have:
.Cells(1, 1) = Format(Now,"dd.mm.yy hh:mm")
or even better
.Cells(1, 1) = Now
then format the column as follows:
Columns("A:A").NumberFormat = "dd.mm.yy hh:mm"
Note: Its possible that having the mm in the format string could not help, although having just tried it out it seems to work ok.
精彩评论