POP up Box

S

Seanie

I am looking to create a simple POP up box that would appear if a
value in cell T10 = Error. Along with a message "Both Values do not
agree". Then just an OK button, once pressed would return the cursor
back to cell B5

The value in T10 is dependent on what the user inputs in to cell B5.
Obviously if T10 = "OK" then the POP up should not appear

Thanks
 
S

Seanie

My attempt was this but nothing happens!

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If .Range("T10").Value = "Error" Then
MsgBox "You have not entered the correct Opening value, please
review and re-enter (see previous days closing value)"

Sheets("Figures").Select
Range("B5").Select

Exit Sub
End If

End Sub
 
P

Per Jessen

Hi

Validation should do it:

Select B5 goto Data > Validation > Allow: Custom, Formula: =T10="OK" >
Enter your message under the Error alert tab.

Well, you do get two buttons OK/Cansel If you press cansel the value entered
is just deleted, if OK then B5 is selected for reentry.

Or you could insert this macro on the code sheet for the desired sheet:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$5" Then
If Range("T10").Value = "Error" Then
Msg = MsgBox("Both Values do not agree", vbOKOnly)
Target.Select
End If
End If
End Sub

Regards,
Per
 

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

Top