+ Reply to Thread
Results 1 to 5 of 5

Order Data Based on Cell Value, Trigger Automatically When Cell Value Changes

  1. #1
    Registered User
    Join Date
    09-28-2023
    Location
    London, England
    MS-Off Ver
    MS 365 Version 2307 64-bit
    Posts
    24

    Order Data Based on Cell Value, Trigger Automatically When Cell Value Changes

    Hi all,

    I am trying to get a data set to automatically reorder itself when a value in a cell in a specified column is changed (in the example spreadsheet it would be column C).
    This is what I have so far which works when I manually run the sub, but not when I change a value:

    Please Login or Register  to view this content.
    What am I doing wrong?

    Many thanks in advance!
    Attached Files Attached Files
    Last edited by EllenAW; 03-20-2024 at 06:58 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: Order Data Based on Cell Value, Trigger Automatically When Cell Value Changes

    Hello Ellen,

    You've placed your code (a worksheet_change event code) into a standard module. For it to work when you change a value, you need to place it into the worksheet module. But firstly, delete this line:

    Sub SortDataWithHeader()

    then, to place it into the worksheet module:-

    - Right click on the sheet tab.
    - Select "View Code" from the menu that appears.
    - In the big white code field that then appears, paste your amended code.

    Delete the code that you have in the standard module.

    I hope that this helps.

    Cheerio,
    vcoolio.

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Order Data Based on Cell Value, Trigger Automatically When Cell Value Changes

    When wanting to trigger changes in a range on a worksheet, note:

    - The code for the Worksheet_Change event must be placed within the worksheet module.
    - If the triggering range itself is changed, it means the change event is triggered again. Therefore, you need to turn on/off Application.EnableEvents
    Like this:
    Please Login or Register  to view this content.
    Quang PT

  4. #4
    Registered User
    Join Date
    09-28-2023
    Location
    London, England
    MS-Off Ver
    MS 365 Version 2307 64-bit
    Posts
    24

    Re: Order Data Based on Cell Value, Trigger Automatically When Cell Value Changes

    Thank you very much to you both for your assistance. This helped greatly!

  5. #5
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: Order Data Based on Cell Value, Trigger Automatically When Cell Value Changes

    You're welcome Ellen. I'm glad that we were able to assist and thanks for the rep.

    Cheerio,
    vcoolio.

+ 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. Replies: 6
    Last Post: 12-27-2020, 09:15 PM
  2. IF or SUM IF to calculate percentage of a cell based on a cell trigger
    By BiancaAngel in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-04-2019, 11:19 PM
  3. Trigger message box after user updates VBA form based on data calculated in a cell
    By blackelvis73 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-15-2016, 12:51 PM
  4. [SOLVED] How can we trigger a simple macro based on cell value of another cell automatically with
    By omega0010 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-16-2013, 05:02 PM
  5. Automatically send an email based on the value of a cell and/or trigger date
    By psn.arya in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-05-2013, 06:17 PM
  6. Automatically Trigger Event when Cell Changes
    By Thinkslow in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-01-2013, 03:34 AM
  7. [SOLVED] sorting cell data based on order of digits
    By rosh@excel in forum Excel General
    Replies: 7
    Last Post: 12-12-2012, 02:52 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