PC Review


Reply
Thread Tools Rate Thread

Check current location

 
 
=?Utf-8?B?SmVmZg==?=
Guest
Posts: n/a
 
      17th Jul 2007
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.


 
Reply With Quote
 
 
 
 
NickHK
Guest
Posts: n/a
 
      17th Jul 2007
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" <(E-Mail Removed)> wrote in message
news:2DEC2038-1176-4A00-AF86-(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      17th Jul 2007
If Intersect(Activecell, Range("H1:M10")) Is Nothing Then
MsgBox "Not in correct location"
End If

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Jeff" <(E-Mail Removed)> wrote in message
news:2DEC2038-1176-4A00-AF86-(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
=?Utf-8?B?SmVmZg==?=
Guest
Posts: n/a
 
      17th Jul 2007
Perfect,

Thanks very much

"Bob Phillips" wrote:

> If Intersect(Activecell, Range("H1:M10")) Is Nothing Then
> MsgBox "Not in correct location"
> End If
>
> --
> HTH
>
> Bob
>
> (there's no email, no snail mail, but somewhere should be gmail in my addy)
>
> "Jeff" <(E-Mail Removed)> wrote in message
> news:2DEC2038-1176-4A00-AF86-(E-Mail Removed)...
> > 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.
> >
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I check the current value of check box not reffering it by alekm Microsoft Access Form Coding 2 14th May 2010 11:27 AM
Macro - save to current location vs excel default location leezard Microsoft Excel Misc 0 28th Oct 2008 03:04 PM
Check location of current db to ensure it is not a copy =?Utf-8?B?TmljZWFjdGlvbg==?= Microsoft Access Security 1 9th Aug 2007 12:54 PM
How do I get the current ROW location. Craig & Co. Microsoft Excel Misc 3 25th Oct 2004 04:54 AM
location of current CF for PPCs? Jim Microsoft Dot NET Compact Framework 4 6th Nov 2003 12:23 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:48 PM.