+ Reply to Thread
Results 1 to 4 of 4

Run Worksheet_SelectionChange when moving away from one specific cell, not all others

  1. #1
    Registered User
    Join Date
    10-16-2017
    Location
    Nashville, TN
    MS-Off Ver
    2013
    Posts
    5

    Run Worksheet_SelectionChange when moving away from one specific cell, not all others

    I have the following code which I am using to try to update the security of other cells based on values entered. I don't want this to run every time the user moves from one editable field to another elsewhere in the worksheet.
    I think I need to use "Intersect" but honestly, I don't know exactly how.

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Re: Run Worksheet_SelectionChange when moving away from one specific cell, not all others

    I am not sure what the code is doing or if the active sheet is sheet1, but this is one way to set the target range.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-16-2017
    Location
    Nashville, TN
    MS-Off Ver
    2013
    Posts
    5

    Re: Run Worksheet_SelectionChange when moving away from one specific cell, not all others

    The code is updating the locked/unlocked status of cell S3 depending on the value selected in cell J3; and if S3 is unlocked, then based on the value chosen for S3, the same lock/unlock setting is being updated for cell S5

    There is only one worksheet to this project, so yes Sheet1 is the active sheet.

    I tried to insert the code you suggested, but unfortunately that did not work; cell S3 remained locked

    My goal is this - I only want this code to run when the user moves from J3 to another cell; and from S3 to another cell. I would prefer that elsewhere in the worksheet when the selected cell is changed that it not run the code every time

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Re: Run Worksheet_SelectionChange when moving away from one specific cell, not all others

    Okay, I am sure we are just dealing with different terminologies.

    The code snippet I gave you shows how to determine the range when you have made a selection, you can use the same kind of code in the worksheet change event.

+ 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] Code for moving the cell cursor in specific location
    By Hovoruha Octavian in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-21-2016, 01:00 PM
  2. Using Worksheet_SelectionChange, so code only runs when specific cells are changed
    By Kristine T. in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-20-2015, 08:49 PM
  3. Moving a row if a specific cell contains a number
    By LionTamer in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-30-2011, 04:12 AM
  4. Moving rows to specific sheets if a cell is filled
    By KWIN in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-16-2011, 05:05 PM
  5. moving specific text within a cell
    By Rnash in forum Excel General
    Replies: 4
    Last Post: 07-08-2010, 09:31 AM
  6. [SOLVED] finding blank cell and moving specific data into it
    By BeJay in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-30-2006, 02:10 PM
  7. Replies: 2
    Last Post: 10-06-2005, 02:05 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