Fighting a date format
On Feb 6, 9:47*am, jeremiah
wrote:
I need the following to return the value of the cell, not the word "TRUE", I
have tried multiple ways to get this with no luck. *Am sure it is an obvious
change.
For Each cell In Range("b:b")
* * If cell.Value Like "* Totals" Then
* * * * cell.Offset(5, 0) = IsDate(Range("C3"))
* * * * selection.NumberFormat = "m/d/yyyy"
* * End If
Jeremiah,
It may help for you to see how your program is behaving. You might
want to inswer the following code, step through your program (F8), and
watch the Immediate Window (View | Immediate Window).
For Each cell In Range("b:b")
Debug.Print "cell Addrs:"; cell.Address
If cell.Value Like "* Totals" Then
cell.Offset(5, 0) = IsDate(Range("C3"))
Debug.Print "cell Offset Addrs:"; cell.Offset(5,
0).Address
Selection.NumberFormat = "m/d/yyyy"
Debug.Print "selection Addrs:"; Selection.Address
End If
Next
I think you may be looking for the following (but I'm not sure because
I don't know what your exact objective is):
For Each cell In Range("b:b")
If cell.Value Like "* Totals" Then
If IsDate(cell.Offset(5, 0).Value) Then
cell.Offset(5,0).NumberFormat = "m/d/yyyy"
End If
End If
Next
|