+ Reply to Thread
Results 1 to 4 of 4

Cell change in a range error if other cell outside that range is changed.

  1. #1
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Cell change in a range error if other cell outside that range is changed.

    I have a worksheet which besides other things the worksheet also contains pivot table.

    The code in that worksheet is copied from support microsoft dot com :
    Please Login or Register  to view this content.
    Range("X5:X100") is in a Validation state with a drop down list aaa, bbb, ccc.
    Basically, I want only if the value of any cell (based on the user choose from the validation list) in Range("X5:X100") is "ccc" then run the macro.
    It works well.

    However when I change any value outside Range("X5:X100"), it gives me Run-time-error "91" : Object variable or With block variable not set.
    For example, after I type "anything" in Range("A1"), it gives me that error. The same thing if I delete that "anything" text (so now A1 is blank), it gives me that error.

    I thought the command [ If Application.Intersect(KeyCells, Range(Target.Address)).Value = "ccc" ] is something like :
    ONLY if any cell within Range("X5:X100") value is "ccc" then do something

    Consequently (I thought) :
    A. if any cell inside Range("X5:X100") is changed but not contains "ccc" then do nothing
    B. if any cell outside Range("X5:X100") is changed then do nothing

    Point A works well, but point B gives me that error.
    How do I resolve the problem ?

    Any kind of help would be greatly appreciated.
    Thank you in advanced.

  2. #2
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Cell change in a range error if other cell outside that range is changed.

    I've found the solution.

    Please Login or Register  to view this content.
    Thank you.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,448

    Re: Cell change in a range error if other cell outside that range is changed.

    Thank you for letting us know.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Cell change in a range error if other cell outside that range is changed.

    Quote Originally Posted by AliGW View Post
    Thank you for letting us know.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Thank you for letting me know about this AliGW.

+ 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] Change a cell in the same row but different column when a cell in a range is changed
    By ajam in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-06-2016, 12:25 PM
  2. [SOLVED] When cell value within range is changed, make cell bold
    By jokris in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-08-2016, 09:28 AM
  3. [SOLVED] Change event to Add or update comment with input box when cell in a range is changed
    By fratello in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-29-2012, 06:40 AM
  4. change values in a range when cell value is changed in that row
    By hattisaeed in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-31-2011, 09:14 AM
  5. Error: Cannot change the part of merged cell - When trying to lock cells in range
    By Ranjani in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-09-2009, 12:03 PM
  6. [SOLVED] Change cell colour for a cell or range within a predefined range
    By Martin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-23-2005, 02:06 PM
  7. Worksheet Change Event-when a cell with a certain range of cells) are changed?
    By Steph in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-25-2005, 07:06 PM

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