Verify correct cell

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

Guest

I have a rectangle on Sheet1, when the user clicks this rectangle I want to
make sure they are in 1 of 7 cells that will receive the information they
will enter from a userform. If they are in one of these 7 cells the userform
will load but if they are not a message will show that they are in the wrong
cell and cannot enter the information. Can this be done?
 
Hi
Dim ChkRng
Set ChkRng = Intersect(ActiveCell, Range("A1:A7"))
If ChkRng Is Nothing Then
MsgBox "Sorry, can't go further active cell is not in the required range"
Exit Sub
Else
'do your stuff
End If

HTH
Cordially
Pascal
 
Thanks worked great.

papou said:
Hi
Dim ChkRng
Set ChkRng = Intersect(ActiveCell, Range("A1:A7"))
If ChkRng Is Nothing Then
MsgBox "Sorry, can't go further active cell is not in the required range"
Exit Sub
Else
'do your stuff
End If

HTH
Cordially
Pascal
 

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