I would like to ask that if the "Denied" word is enter in this Range("D2:D500") then values after it's row cannot be entered only in Column E.
wherever "Denied" word enter to Column D then only below cells at Column E don’t have right to enter any value, where else user can enter the values at Column A, B, C and D only. If user enter the value in Column E then display the message "You are not permissible" and clear the content of that cell.
For the Same row the following code I am using is given below:
' this code for Column D which is made for clear data in the same row
If rngTarg Is Nothing Then GoTo ExitHandler
For Each rngToChk In rngTarg
Select Case rngToChk.Value
Case "Denied"
rngToChk.Offset(0, -1).ClearContents
rngToChk.Offset(0, -2).ClearContents
rngToChk.Offset(0, 1).ClearContents
rngToChk.Offset(0, 2).ClearContents
End Select
Next rngToChk
' this code for Column E which will help to user that it won’t have access to enter data in the same row
For Each cell In rngTarg
If cell.Offset(0, -1) = "Denied" Then
cell.Select
MsgBox Excel.Application.UserName & ", As you enter <" & cell.Offset(0, -1) & "> in Column D" _
& vbNewLine & "That is why you cannot enter Value.", vbokOnly + vbInformation, "Information"
cell.ClearContents
cell.Offset(1, 0).Select
GoTo ExitHandler
End If
Next cell
I hope it will help to understand my query.
Thanks & Regards
Muneeb



