View Single Post
  #5   Report Post  
Bob Phillips
 
Posts: n/a
Default

This works

Private Sub Worksheet_Change(ByVal Target As Range)
Dim d As Range
On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Address = "$H$1" Then
If Target.Value = 1 Then
Range("b50") = ""
For Each d In Me.Range("F19:F38")
If d.Value < "" And d.Value 119999 Then
Me.Range("B50") = "ERROR"
End If
Next d
End If
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--

HTH

RP
(remove nothere from the email address if mailing direct)


"JTF" wrote in message
oups.com...
Thanks Doug. I had already looked at that.

I thought that a user defined function could place a value in a cell,
which is essentially what I am trying to do (place an error message in
a cell). But I must have misunderstood.

The next thing I tried to do is call the macro from a cell using the
Worksheet Change Event. That's not working either. I am at the point
now where I have just decided this isn't going to work at all, and I
can't justify spending much more time on it with my very limited
knowledge of vb code (after working the better part of 2 days on it).
I'll just have to figure something else out. There has got to be a way
to do this and have it run automatically.

Thank for everyone's help. These groups are invaluable and it's been a
learning experience and that is never a bad thing. : )