![]() |
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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 07:19 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com