Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub Worksheet_Change()
- If IsEmpty(Range("A:A")) = False Then
- MsgBox "Insert Data in B"
- Activecell.Offset(0,1).Activate
- Call DateTime
- Elseif IsEmpty(Range("B:B")) = False Then
- MsgBox "Insert Data in C"
- Activecell.Offset(0,1).Activate
- Elseif IsEmpty(Range("C:C")) = False Then
- Activecell.Offset(1,0).Activate
- Call IsEmptyRange
- exit sub
- Endif
- Private Sub DateTime()
- Dim Cell As Range
- For Each Cell In Target
- If Cell.Column = Range("A:A").Column Then
- If Cell.Value <> "" Then
- Cells(Cell.Row, "E").Value = Int(Today)
- Cells(Cell.Row, "E").Value =NOW()-TODAY()
- Else
- Cells(Cell.Row, "E").Value = ""
- Cells(Cell.Row, "F").Value = ""
- End If
- End If
- Next Cell
- Exit Sub
- End Sub
- Sub IsEmptyRange()
- Dim cell As Range
- Dim bIsEmpty As Boolean
- bIsEmpty = False
- For Each cell In Range("A:C")
- If IsEmpty(cell) = True Then
- bIsEmpty = True
- Exit For
- End If
- Next cell
- If bIsEmpty = True Then
- MsgBox "There are empty cells in your range"
- Else
- 'There are NO empty cells in your range
- MsgBox "All cells have values!"
- End If
- Exit Sub
- End Sub
Add Comment
Please, Sign In to add comment