View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Todd
 
Posts: n/a
Default Cell can not be blank

That's what I tried and when you tab over to cell b1 it gives you the mesage
box first before leaving the cell. I need it to only come up if you leave
the cell.

"CLR" wrote:

Maybe something like this, just for two cells...could be expanded

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Not Range("a1").Value < "" Then
MsgBox "cant do that"
Range("a1").Select
ElseIf Not Range("b1").Value < "" Then
MsgBox "cant do that"
Range("b1").Select
End If
End Sub

hth
Vaya con Dios,
Chuck, CABGx3


"Todd" wrote:

Is there any way to get this to work for 3 other cells. When I put in
another if statement and go to my worksheet when I change to the next cell
where my new if statement goes with, the message box pops up as soon as the
cell is activated. I would like for it to activate when the cell is left if
it is blank. Any ideas. The first code is exatly what I am looking for.

"CLR" wrote:

Maybe this..........

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Not Range("a1").Value < "" Then
MsgBox "cant do that"
Range("a1").Select
Else
End If
End Sub


Vaya con Dios,
Chuck, CABGx3



"Todd" wrote:

Is there any way to force a user to input data in to a cell and if they move
off when it is blank it will prompt them to input data. I have tried the
validation rules but it does not stop blank cell.