View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Check current location

Jeff,
Depends how you determine the correct location:

Const MAXROW As Long = 10
If ActiveCell.Row MAXROW Then
MsgBox "Must be on/before row " & MAXROW
End If

Const MAXCOL As Long = 10
If ActiveCell.Column MAXCOL Then
MsgBox "Must be on/before column " & MAXCOL
End If

Const OK_RANGE As String = "D3:M26"
If Intersect(ActiveCell, Range(OK_RANGE)) Is Nothing Then
MsgBox "Must be in the range " & OK_RANGE
End If

NickHK

"Jeff" wrote in message
...
Hi,

I'm trying to create a macro that will only run when the active cell is in
certain locations. If the active cell is not in the correct location I

want
to display an error message.

Any ideas gratefully received.