Your
doesn't make sense to your computer.
The "cells" notation in VBA uses Cells(i, j) to describe the cell in the i-th row and j-th column of a worksheet. i.e. both i and j must be numbers, more specifically positive integers.
Range("WTime") isn't an integer, it's a cell or group of cells so your type mismatch isn't surprising.
If you like you could use
without getting a type mismatch (for the above reason anyway)
Also, in your second line of code, if WTime is not a single cell then trying to compare it (or its offset which is not a single cell either) to a single value will also give type mismatch.
You can set a range of more than one cell equal to some value but you can't compare it to a single value.
e.g. try the codes
One will work and the other won't.
Bookmarks