+ Reply to Thread
Results 1 to 2 of 2

Case with Intersect only works if first case true

  1. #1
    Registered User
    Join Date
    12-27-2016
    Location
    Ontario, Canada
    MS-Off Ver
    2010
    Posts
    34

    Case with Intersect only works if first case true

    The following code works if the selected cell in within the first named range (columns B:J) but if I try putting the activecell in the next named range (columns K:S) an error occurs "object variable or with block variable not set". What I am trying to do is determine which named range the selected cell is in. If it isn't in any of the 5 named ranges then execute the code section that the activecell isn't in any of the 5 specified named ranges. Why does it work in the first case if the activecell in in that range but fails if I try putting the active cell within the next named range. I am doing entire columns for named ranges so Line1Cols are B:J, Line2Cols is defined as K:S and so on.


    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    01-16-2017
    Location
    [email protected]
    MS-Off Ver
    2016
    Posts
    5

    Re: Case with Intersect only works if first case true

    Hi BobZZ,

    I couldn't get your code to work because intersect returns an error if there is no overlapping cells, so doesn't work well in Select... Case. I was able to get it working with this following code however, hope it is still useful to you in this format-
    Please Login or Register  to view this content.
    Regards,
    TheSilkCode

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Formula works in one case, but not another
    By udrmichelle in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-19-2015, 02:47 PM
  2. [SOLVED] Lower Case to Upper Case but No Auto Correction : Solved by Mod (6StringJazzer)
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-27-2014, 10:44 AM
  3. Write a subroutine in a module to change case upon exit of a cell to upper case
    By Stephd22 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-15-2013, 06:39 PM
  4. Using Intersect with Case Select
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-20-2010, 07:22 PM
  5. Pop-up message in case value becomes true
    By Gebruiker01 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-06-2010, 03:27 PM
  6. [SOLVED] Utilize a Select Case Statement in Target Intersect Statement
    By max57 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-29-2009, 08:55 PM
  7. Replies: 2
    Last Post: 12-09-2005, 05:15 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1