Emanuel1980
New Member
- Joined
- Jul 21, 2021
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
Hi,
I'm using the below code to pop a message box whenever the value of cells in column "J" is greater than 8. The target value which is 8 in this case is in Cell A1.
The issue i'm having here is i get the pop up for any value that is entered whcih should not be the case. It must pop up only when the value is greater "8"
PLEASE HELP
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count = 1 Then
Dim rngJ As Range, rngA As Range
xA = "A1"
Set rngJ = Application.Intersect(Target.EntireRow, Range("J1").EntireColumn)
Set rngA = Application.Intersect(Target.EntireRow, Range("A1").EntireColumn)
If rngJ.Value > rngA.Value Then
MsgBox Prompt:="The hours entered is greater than your scheduled working hours, please enter less than or equal to 8 hours! THANK YOU", Title:="Infovision Social"
Target.Value = ""
End If
End If
End Sub
I'm using the below code to pop a message box whenever the value of cells in column "J" is greater than 8. The target value which is 8 in this case is in Cell A1.
The issue i'm having here is i get the pop up for any value that is entered whcih should not be the case. It must pop up only when the value is greater "8"
PLEASE HELP
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count = 1 Then
Dim rngJ As Range, rngA As Range
xA = "A1"
Set rngJ = Application.Intersect(Target.EntireRow, Range("J1").EntireColumn)
Set rngA = Application.Intersect(Target.EntireRow, Range("A1").EntireColumn)
If rngJ.Value > rngA.Value Then
MsgBox Prompt:="The hours entered is greater than your scheduled working hours, please enter less than or equal to 8 hours! THANK YOU", Title:="Infovision Social"
Target.Value = ""
End If
End If
End Sub