ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Verify correct cell (https://www.excelbanter.com/excel-programming/398677-verify-correct-cell.html)

jnf40

Verify correct cell
 
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?

papou[_2_]

Verify correct cell
 
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

"jnf40" a écrit dans le message de news:
...
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?




jnf40

Verify correct cell
 
Thanks worked great.

"papou" wrote:

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

"jnf40" a écrit dans le message de news:
...
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?






All times are GMT +1. The time now is 11:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com