Private Sub Worksheet_Change(ByVal Target As Range)
Dim count
Dim lngCounter As Long
Dim cell As Range
Dim s As Object
Set s = CreateObject("SAPI.SpVoice")
If Not Intersect(Target, Range("L:L")) Is Nothing Then
If Cells(Target.Row, "L") = Cells(Target.Row, "K") Then Beep
End If
If Target.Columns.count > 1 Then Exit Sub
If Not Intersect(Target, Range("M3:M5000")) Is Nothing And _
Target.count = 1 And IsNumeric(Target.Value) Then
If Target.Value > 0 Then
Application.EnableEvents = False
count = WorksheetFunction. _
RoundUp(Cells(Target.Row, "K") / Target.Value, 0)
Target.Offset(1).Resize(count).EntireRow.Insert
With Cells(Target.Row, "L")
.Formula = "=SUM(" & .Offset(1, -1).Resize(count).Address(0, 0) & ")"
End With
Application.EnableEvents = True
Cells(Target.Row, "N").Value = count
s.Speak count
For i = 1 To 100
i = i + 1
Next i
s.Speak "boxes for scanning!"
End If
End If
If Not Intersect(Target, Range("A3:A5000")) Is Nothing Then
Cells(Target.Row, Target.Column + 1).Activate
End If
If Not Intersect(Target, Range("H3:I5000")) Is Nothing Then
Cells(Target.Row, Target.Column + 1).Activate
End If
If Not Intersect(Target, Range("I3:I5000")) Is Nothing Then
Cells(Target.Row, Target.Column + 2).Activate
End If
If Not Intersect(Target, Range("K3:K5000")) Is Nothing Then
Cells(Target.Row, Target.Column - 1).Activate
End If
If Not Intersect(Target, Range("B3:B5000")) Is Nothing Then
Cells(Target.Row, Target.Column + 3).Activate
End If
If Not Intersect(Target, Range("E3:E5000")) Is Nothing Then
Cells(Target.Row, Target.Column + 3).Activate
End If
If Target.Column = 8 And Target.count = 1 Then
If Not IsNull(Target) Then
If Target.Offset(, -4).Text Like "##:##" Then
Target.Offset(, 5).Select
End If
End If
End If
If Not Intersect(Target, Range("J3:J5000")) Is Nothing Then
Cells(Target.Row + 1, WorksheetFunction.Max(1, Target.Column - 2)).Activate
End If
If Not Intersect(Target, Range("M3:M5000")) Is Nothing Then
Cells(Target.Row + 1, WorksheetFunction.Max(1, Target.Column - 5)).Activate
End If
If Not Intersect(Target, Range("K3:K5000")) Is Nothing Then
Cells(Target.Row, WorksheetFunction.Max(3)) = Date
Cells(Target.Row, WorksheetFunction.Max(4)) = Time
End If
If Not Intersect(Target, Range("F3:F5000")) Is Nothing Then
Cells(Target.Row, WorksheetFunction.Max(7)) = Range("M1").Value
End If
Application.EnableEvents = False
If Not Intersect(Target, Range("O3:O5000")) Is Nothing Then
If IsEmpty(Target) Then
Cells(Target.Row, 16).ClearContents
ElseIf IsNumeric(Target) Then
If Target.Value <> 0 And Cells(Target.Row, "N") > 0 Then
Cells(Target.Row, 16) = "Total"
ElseIf Target.Value < 0 Then
Cells(Target.Row, 16) = "Short"
Else
Cells(Target.Row, 16) = "Overs"
End If
Else
Cells(Target.Row, 16) = "Overs"
End If
End If
Application.EnableEvents = True
Exit Sub
ErrHandler:
s.Speak "Not!"
For i = 1 To 100
i = i + 1
Next i
s.Speak "on the list"
MsgBox "Value not found"
Range("B1").Activate
End Sub
Bookmarks