CellValueOfZero

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a macro that is activated by button. I have a cell b4 that an operator
must
enter a numerical value greater than zero.
I need a sub that would check the value of cell b4. If the value is greater
than zero,
then the sub would proceed.
If cell b4 is equal to 0, then a message box would appear telling the operator
that a 0 value has been entered. Once the operator clicks the OK in the
message
box, an exit sub would be activated and the operator
would be returned to the data entry screen.
thanks for any assistance.
 
Hi Mike,

Try this for beggining:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("B4") <> 0 Then
Call Test
ElseIf Range("B4") = 0 Then
MsgBox "a 0 value has been entered!"
Else
End If
End Sub


Sub Test()
MsgBox "Bla Bla Bla"
End Sub

Regards.
Jorge
 
A little bit more:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If IsEmpty(Range("B4")) Then
Exit Sub
End If

If Range("B4") <> 0 Then
Call Test
ElseIf Range("B4") = 0 Then
MsgBox "a 0 value has been entered!"
Else
Exit Sub
End If
End Sub


Sub Test()
MsgBox "Bla Bla Bla"
End Sub


Regards.
Jorge
 
And a little bit more:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If IsEmpty(Range("B4")) Then
Exit Sub
End If

If Range("B4") <> 0 Then
Call Test
ElseIf Range("B4") = 0 Then
MsgBox "a 0 value has been entered!"
Else
Exit Sub
End If
Range("B4").ClearContents
End Sub


Sub Test()
MsgBox "Bla Bla Bla"
End Sub

Regards.
Jorge
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top