View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
JBeaucaire[_90_] JBeaucaire[_90_] is offline
external usenet poster
 
Posts: 222
Default Block cell if specific condition exists

Put this formula in the Sheet Module where you want column B to be
inaccessible. If the cell in column A has "Filled" as its value, Excel will
push the cursor back out of column B every time the user tries to go there.
======
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Not Intersect(Target, Range("B:B")) Is Nothing Then
If Target.Offset(0, -1).Value = "Filled" Then Target.Offset(0,
1).Select
End If
End Sub
======
--
"Actually, I *am* a rocket scientist." -- JB

Your feedback is appreciated, click YES if this post helped you.


"WildWill" wrote:

I have 2 cells, A1 and B1. I want to condition B1 so that if A1 contains a
specific value or text, i.e. A1="Filled", then B1 will be blocked and it will
not be possible to enter any data into B1. If A1 is any other value except
for "Filled", B1 will behave normally and will allow any data entry.