Help, I have the following VBA code in my spreadsheet and it works fine on my home computer. However, when I email it works on some computers and not on others. Even on my work computer sometimes it works and some times it doesn't. I have the Macro Setting set to "Disable all macros with notification". Any ideas as to why the VBA code does not always work?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim aCell As Range
If Not Intersect(Range("G3:AK125"), Target) Is Nothing Then
For Each aCell In Target
If UCase(Range("F" & aCell.Row)) <> "N" And UCase(Range("F" & aCell.Row)) <> "Y" Then
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
Exit Sub
End If
If Application.WorksheetFunction.IsText(aCell.Value) Then
If UCase(aCell.Value) = "BH" Then
If UCase(Range("F" & aCell.Row)) = "N" Or _
Cells(126, aCell.Column) < 0.9 Then
Application.EnableEvents = False
aCell.Value = 0
Application.EnableEvents = True
End If
End If
End If
If Application.WorksheetFunction.IsText(aCell.Value) Then
If UCase(aCell.Value) = "AL" Then
If UCase(Range("F" & aCell.Row)) = "N" Or _
(Range("AQ" & aCell.Row)) < "0" Or _
Cells(126, aCell.Column) < 0.9 Then
Application.EnableEvents = False
aCell.Value = 0
Application.EnableEvents = True
End If
End If
End If
Next aCell
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim aCell As Range
If Not Intersect(Range("G3:AK125"), Target) Is Nothing Then
For Each aCell In Target
If UCase(Range("F" & aCell.Row)) <> "N" And UCase(Range("F" & aCell.Row)) <> "Y" Then
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
Exit Sub
End If
If Application.WorksheetFunction.IsText(aCell.Value) Then
If UCase(aCell.Value) = "BH" Then
If UCase(Range("F" & aCell.Row)) = "N" Or _
Cells(126, aCell.Column) < 0.9 Then
Application.EnableEvents = False
aCell.Value = 0
Application.EnableEvents = True
End If
End If
End If
If Application.WorksheetFunction.IsText(aCell.Value) Then
If UCase(aCell.Value) = "AL" Then
If UCase(Range("F" & aCell.Row)) = "N" Or _
(Range("AQ" & aCell.Row)) < "0" Or _
Cells(126, aCell.Column) < 0.9 Then
Application.EnableEvents = False
aCell.Value = 0
Application.EnableEvents = True
End If
End If
End If
Next aCell
End If
End Sub