Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Determine if column is within range of columns

Hi All,

Does anybody have the code to determine if the ActiveCell is within a range
of columns ie F:CZ ?

I think l should be able to use the Intersect function if l state the full
range (ie F6:CZ5006) but have had no luck so far.

For various reasons l cannot restrict the selection of cells by locking and
using = xlUnlockedCellsOnly using the worksheet activate event.

All help / suggestions gratefully received

Regards

Michael Beckinsale


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Determine if column is within range of columns

Not Intersect(activecell,range("F:CZ")) Is Nothing

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Michael Beckinsale" wrote in message
...
Hi All,

Does anybody have the code to determine if the ActiveCell is within a

range
of columns ie F:CZ ?

I think l should be able to use the Intersect function if l state the full
range (ie F6:CZ5006) but have had no luck so far.

For various reasons l cannot restrict the selection of cells by locking

and
using = xlUnlockedCellsOnly using the worksheet activate event.

All help / suggestions gratefully received

Regards

Michael Beckinsale




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Determine if column is within range of columns

Bob,

Sorry l must have my "dense" head on this morning!

How do l use this code? somrthing like this ?

If Not Intersect(activecell,range("F:CZ")) Is Nothing Then
Exit sub
Else
Code to do something

Regards

Michael

"Bob Phillips" wrote in message
...
Not Intersect(activecell,range("F:CZ")) Is Nothing

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Michael Beckinsale" wrote in message
...
Hi All,

Does anybody have the code to determine if the ActiveCell is within a

range
of columns ie F:CZ ?

I think l should be able to use the Intersect function if l state the
full
range (ie F6:CZ5006) but have had no luck so far.

For various reasons l cannot restrict the selection of cells by locking

and
using = xlUnlockedCellsOnly using the worksheet activate event.

All help / suggestions gratefully received

Regards

Michael Beckinsale






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Determine if column is within range of columns

Hi Michael,

No the other way around

If Not Intersect(activecell,range("F:CZ")) Is Nothing Then
Code to do something

because the Intersect will return Nothing if they don't (intersect that is),
so Intersect(...) Is Nothing checks if they don't intersect, the Not checks
the negative of that (i.e if they DO intersect).

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Michael Beckinsale" wrote in message
...
Bob,

Sorry l must have my "dense" head on this morning!

How do l use this code? somrthing like this ?

If Not Intersect(activecell,range("F:CZ")) Is Nothing Then
Exit sub
Else
Code to do something

Regards

Michael

"Bob Phillips" wrote in message
...
Not Intersect(activecell,range("F:CZ")) Is Nothing

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Michael Beckinsale" wrote in message
...
Hi All,

Does anybody have the code to determine if the ActiveCell is within a

range
of columns ie F:CZ ?

I think l should be able to use the Intersect function if l state the
full
range (ie F6:CZ5006) but have had no luck so far.

For various reasons l cannot restrict the selection of cells by locking

and
using = xlUnlockedCellsOnly using the worksheet activate event.

All help / suggestions gratefully received

Regards

Michael Beckinsale








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Determine if column is within range of columns

Bob,

I realised it was the wrong way round as soon as l sent it to you. However
it was my mistake, l didn't put a space between NotIntersect!
I'm being a real dimlo this morning.

Many thanks for your help

Michael

"Bob Phillips" wrote in message
...
Hi Michael,

No the other way around

If Not Intersect(activecell,range("F:CZ")) Is Nothing Then
Code to do something

because the Intersect will return Nothing if they don't (intersect that
is),
so Intersect(...) Is Nothing checks if they don't intersect, the Not
checks
the negative of that (i.e if they DO intersect).

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Michael Beckinsale" wrote in message
...
Bob,

Sorry l must have my "dense" head on this morning!

How do l use this code? somrthing like this ?

If Not Intersect(activecell,range("F:CZ")) Is Nothing Then
Exit sub
Else
Code to do something

Regards

Michael

"Bob Phillips" wrote in message
...
Not Intersect(activecell,range("F:CZ")) Is Nothing

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Michael Beckinsale" wrote in message
...
Hi All,

Does anybody have the code to determine if the ActiveCell is within a
range
of columns ie F:CZ ?

I think l should be able to use the Intersect function if l state the
full
range (ie F6:CZ5006) but have had no luck so far.

For various reasons l cannot restrict the selection of cells by
locking
and
using = xlUnlockedCellsOnly using the worksheet activate event.

All help / suggestions gratefully received

Regards

Michael Beckinsale










Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Determine a result of one column based on conditions in two column tel703 Excel Discussion (Misc queries) 1 March 25th 10 05:01 PM
Determine last row in columns 1-4 to copy a formula in column 5 GEB Excel Programming 2 June 21st 05 09:47 PM
print 3 column range in six columns dawgpilot Excel Discussion (Misc queries) 3 April 28th 05 10:53 PM
Referencing a Column in a Selected Range of Columns Rob G Excel Programming 3 October 21st 04 05:21 PM
Determine start column/ end column of Merged Cell jC! Excel Programming 3 July 8th 04 12:05 PM


All times are GMT +1. The time now is 09:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"