VBA Date Format Cell Check

  • Thread starter Thread starter Kim
  • Start date Start date
K

Kim

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
 
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
 
Or have i misunderstood, do you mean

If ActiveCell.NumberFormat = "mm/dd/yyyy" Then

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top