View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default VBA Date Format Cell Check

Maybe

If IsDate(ActiveCell.Value) Then
Stop
ActiveCell.Offset(1, 0).Activate
Else
ActiveCell.Select
Selection.Cut
ActiveCell.Offset(-1, 1).Activate
ActiveSheet.Paste
ActiveCell.Offset(1, -1).Activate
End If


Mike

"Kim" wrote:

Hi,

I'm trying to check cells for Date format or not, but the code below isn't
working properly. Despite confirming the Date format in the cells being
checked, my code isn't running the command (ActiveCell.Offset(1, 0).Activate
Instead, it's branching to the Else command, which I do not want. This seems
simple, can someone help?

If ActiveCell.NumberFormat = "Date" Then
ActiveCell.Offset(1, 0).Activate
Else
ActiveCell.Select
Selection.Cut
ActiveCell.Offset(-1, 1).Activate
ActiveSheet.Paste
ActiveCell.Offset(1, -1).Activate
End If



Thanks!
Kim