Guest User

Untitled

a guest
Dec 16th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. Private Sub Worksheet_Change(ByVal Target As Range)
  2.  
  3. Set w = ActiveSheet.Range("J4:L4")
  4.  
  5. For Each C In w
  6.  
  7. If C.Value <> "" And Not IsDate(C) Then
  8. C.ClearContents
  9.  
  10. MsgBox "Only a Date is permitted in this cell."
  11. End If
  12.  
  13. If C.Value = "" And Not IsDate(C) Then
  14. C.Interior.ColorIndex = 0
  15. Else
  16. C.Interior.ColorIndex = 4
  17. End If
  18.  
  19. Next C
  20.  
  21. End Sub
  22.  
  23. Sub CopyLastCell()
  24. Range("J4").End(xlToRight).Copy
  25. Range("M4").PasteSpecial
  26.  
  27. Application.CutCopyMode = False
  28. End Sub
Add Comment
Please, Sign In to add comment