+ Reply to Thread
Results 1 to 5 of 5

Event Procedure - Worksheet_SelectionChange

  1. #1
    Forum Contributor
    Join Date
    01-21-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    227

    Event Procedure - Worksheet_SelectionChange

    Hello,

    I have an excel with data validation lists in c11 and c19, based on code selected in c11, the drop down list in c19 changes to ones that are linked to that specific value in c11.

    I want to add Worksheet_SelectionChange so that when each time the value in c11 is changed, c19 value is cleared automatically.

    Can someone plz help me with that?

    Thanks!

  2. #2
    Valued Forum Contributor
    Join Date
    12-02-2012
    Location
    Melbourne, VIC
    MS-Off Ver
    Excel 2016
    Posts
    750

    Lightbulb Re: Event Procedure - Worksheet_SelectionChange

    It seems what you are looking for is Worksheet_Change event with Intesection between Target & cell C11 of the worksheet.

    Worksheet_SelectionChange event is fired every time the user changes the active cell by selecting another cell. Worksheet_Change event is fired when any cell is changed by the user or an external link. However, the event wouldn't fire if the cell value changes because of a formula.

    Hope this helps !

  3. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Event Procedure - Worksheet_SelectionChange

    Hi saksmb and Jewel,

    I agree with Jewel.

    Here are the details:
    1. If a cell is changed manually or by VBA, Workseet_Change() is needed.

    2. If a cell is changed manually or by VBA and the old value is needed:
    a. A global variable is needed to save the old value.
    b. Worksheet_SelectionChange() is needed to identify the value of the old value.
    c. Workseet_Change() is needed to identify the new value, and possibly take further action.

    3. If a range of values is changed by Formula (including a range containing only one cell):
    a. A global array of variables is needed to store the old values.
    b. The global array needes to be initialized by Workbook_Open().
    c. Worksheet_Calculate() is needed to identify which cells in the range changed value.

    See the code below or the attached file which implements all of the above.

    Lewis

    Code like the following needs to be in ThisWorkbook (Formula changes cells):
    Please Login or Register  to view this content.
    Code like the following needs to be in an ordinary module (Formula changes cells):
    Please Login or Register  to view this content.
    Code like the following needs to be in the 'Sheet' Module:
    Please Login or Register  to view this content.
    Last edited by LJMetzger; 04-30-2014 at 05:46 AM. Reason: PrettyPrint

  4. #4
    Registered User
    Join Date
    01-20-2014
    Location
    Scotland
    MS-Off Ver
    Excel 2003
    Posts
    59

    Re: Event Procedure - Worksheet_SelectionChange

    Quote Originally Posted by LJMetzger View Post
    Hi saksmb and Jewel,

    I agree with Jewel.

    Here are the details:
    1. If a cell is changed manually or by VBA, Workseet_Change() is needed.

    2. If a cell is changed manually or by VBA and the old value is needed:
    a. A global variable is needed to save the old value.
    b. Worksheet_SelectionChange() is needed to identify the value of the old value.
    c. Workseet_Change() is needed to identify the new value, and possibly take further action.

    3. If a range of values is changed by Formula (including a range containing only one cell):
    a. A global array of variables is needed to store the old values.
    b. The global array needes to be initialized by Workbook_Open().
    c. Worksheet_Calculate() is needed to identify which cells in the range changed value.

    See the code below or the attached file which implements all of the above.

    Lewis

    Code like the following needs to be in ThisWorkbook (Formula changes cells):
    Please Login or Register  to view this content.
    Code like the following needs to be in an ordinary module (Formula changes cells):
    Please Login or Register  to view this content.
    Code like the following needs to be in the 'Sheet' Module:
    Please Login or Register  to view this content.
    How do I change this for a range of single cell? i.e. I want it to include the following cells:

    "AC6", "AC9", "AC12", "AC15", AC18", "AC21", "AC24"

    Any ideas?

  5. #5
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Event Procedure - Worksheet_SelectionChange

    darkblueblood,

    Please do not cross post as it does nothing but cause confusion. See your original thread for a reply: http://www.excelforum.com/excel-prog...lculation.html

    Lewis

+ 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] Worksheet_SelectionChange Event to Run Public Sub MyMacro
    By KarlaM in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-09-2013, 04:50 PM
  2. Differentiate keypresses in Worksheet_SelectionChange event
    By Mervil in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-08-2010, 03:59 AM
  3. Using Worksheet_SelectionChange() event macro
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-27-2007, 05:32 PM
  4. Worksheet_selectionchange Event
    By Alex Mackenzie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-28-2005, 12:05 PM
  5. [SOLVED] Stop Worksheet_SelectionChange event from firing?
    By Ed in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 01-05-2005, 09:06 AM

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