Hi all,
Here's the table i am using:
A B C D E F G H I J K L 1 EMP NO 1-Sept 2-Sept 3-Sept 4-Sept 5-Sept 6-Sept Count of N Count of A Count of G 2 N N N A A G G N 4 2 2 3 N N A A A G A G 2 4 2 4 N N A A A G A G 2 4 2 5 N N A A A G A G 2 4 2
Columns J,K and L are the counts of Ns, As and Gs. Have used Count excel formula.
So my problem is this. I need to write a macro to check each value from J2 to L4. If the value in any of the cell in the range J2 to L4 goes beyond 3 it should give an error pop-up saying -"Error-Too many values". Note that the values in J2 to J4 keep changing when the values f N, A, and G changes in A1 to H4.
if i am entering, lets say N in row 1, if i give 3 Ns it shouldn't give me error. But the 4th N entry, once i enter it should give a pop up error. It can let me enter more than 3 Ns but every-time it crosses 3 it shoud give pop up.
Ex: Enter 1 N - no pop up
Enter 2nd N - no pop up
Enter 3rd N -no pop up
Enter 4th N - Pop up
Enter 5th N- Pop up
Enter 6th N - Pop up .
let me know the macro for this. As a noob i didnt get any proper solution for this. All i wrote was this. But its not of any use.
Option Explicit
Sub Abi()
Dim i As Range
For Each i In Range("J2:L4")
If i.Value > 2 Then
MsgBox "hello"
End If
Next i
End Sub
Bookmarks