Missed the attachment
Note: ' requires the "My Notes" cell to be NAMED as MyNotes
This is, initially, cell Q19. It will move as entries are added and is used to count the rows.
Sub BREAK_START()
'
' BREAK_START Macro
'
' Works OK
Range("Q15").Value = Date
Range("R15").Value = "My name"
Range("S15").Value = "XY"
Range("T15").Value = Format(Now, "hh:mm")
Range("W15").Value = "Break"
Range("V15").Formula = "=IF((IF(+(RC[-1]-RC[-2])=0,""time.."",RC[-1]-RC[-2]))<0,""St>En!"",IF(+(RC[-1]-RC[-2])=0,""St=En!"",RC[-1]-RC[-2]))"
Range("U15").Select
End Sub
Sub WC_START()
'
' BREAK_START Macro
'
' Works OK
Range("Q15").Value = Date
Range("R15").Value = "My name"
Range("S15").Value = "XY"
Range("T15").Value = Format(Now, "hh:mm")
Range("W15").Value = "WC"
Range("V15").Formula = "=IF((IF(+(RC[-1]-RC[-2])=0,""time.."",RC[-1]-RC[-2]))<0,""St>En!"",IF(+(RC[-1]-RC[-2])=0,""St=En!"",RC[-1]-RC[-2]))"
Range("U15").Select
End Sub
Sub BREAK_END()
'
' BREAK_END Macro
'
' Works OK
If Range("T15") = "" Then
MsgBox "Write the START hour first, please."
Else
Range("U15").Value = Format(Now, "hh:mm")
Range("Q15:W15").Copy Range("Q16")
Range("Q16:W16").Insert shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("V16:V17").Locked = False
Range("V16:V17").FormulaHidden = True
Range("Q15:U15").ClearContents
Range("W15").ClearContents
Range("U17").Select
End If
End Sub
Sub Clean_Breaks()
'
' Clean_Breaks Macro
'
' requires the "My Notes" cell to be NAMED as MyNotes
Dim lLR As Long
Dim wsf As WorksheetFunction: Set wsf = WorksheetFunction
lLR = Range("MyNotes").Row - 1
lrows = wsf.Count(Range(Cells(17, "Q"), Cells(lLR, "Q")))
If lrows >= 1 Then
Range("Q17").Resize(lrows, 7).Delete shift:=xlUp
End If
Range("Q15").Select
End Sub
Sub BREAKE_COPY()
'
' BREAKE_COPY Macro
'
' requires the "My Notes" cell to be NAMED as MyNotes
Dim lLR As Long
Dim wsf As WorksheetFunction: Set wsf = WorksheetFunction
lLR = Range("MyNotes").Row - 1
lrows = wsf.Count(Range(Cells(17, "Q"), Cells(lLR, "Q")))
If lrows >= 1 Then
Range("Q17").Resize(lrows, 7).Copy
End If
End Sub
Bookmarks