Currently using a direct formula in the excel sheet: B10=A10-A9 to get the cycle time between the two units
How do use Vba code for this so that each time a press the button the sub created also does this calculation?
Would also like it to conditional format the Cell ( in the example B10) so that the text is highlighted bold in red if value is larger then set time, Cell C2
Current code for click function looks like this
Public countunit As Integer
Public koll As Integer
Private Sub Click()
' function to secure continuing from last used cell if document is closed and repopened
Dim lRow As Long
lRow = Sheets("User Data").Cells(Rows.Count, "A").End(xlUp).Row
If lRow >= 8 Then
koll = 1
countunit = lRow + 1
End If
'click function and stepping to next cell
If koll = 1 Then
Worksheets("User Data").Protect Contents:=False
Worksheets("User Data").Cells(countunit, 1) = Format(Now, "mm/dd/yyyy HH:mm:ss")
countunit = countunit + 1
koll = 1
Cells(2, 4) = "Antal enheter"
Cells(3, 4) = countunit - 9
End If
Worksheets("User Data").Protect Contents:=True
End Sub
How do use Vba code for this so that each time a press the button the sub created also does this calculation?
Would also like it to conditional format the Cell ( in the example B10) so that the text is highlighted bold in red if value is larger then set time, Cell C2
Current code for click function looks like this
Public countunit As Integer
Public koll As Integer
Private Sub Click()
' function to secure continuing from last used cell if document is closed and repopened
Dim lRow As Long
lRow = Sheets("User Data").Cells(Rows.Count, "A").End(xlUp).Row
If lRow >= 8 Then
koll = 1
countunit = lRow + 1
End If
'click function and stepping to next cell
If koll = 1 Then
Worksheets("User Data").Protect Contents:=False
Worksheets("User Data").Cells(countunit, 1) = Format(Now, "mm/dd/yyyy HH:mm:ss")
countunit = countunit + 1
koll = 1
Cells(2, 4) = "Antal enheter"
Cells(3, 4) = countunit - 9
End If
Worksheets("User Data").Protect Contents:=True
End Sub