+ Reply to Thread
Results 1 to 9 of 9

Thread: Worksheet Change Event

  1. #1
    Registered User
    Join Date
    10-20-2011
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    39

    Worksheet Change Event

    Hi,

    I need to link a toggle button to a cell change but am not familiar with the worksheet change event which is what i think i need to use.

    The cell to link to is a time in the format 00:00:00 and each time it decreases + and the toggle button is true i want the code to run.



    Sub togglebutton1_Change(ByVal Target as Range)

  2. #2
    Valued Forum Contributor JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    Japan
    MS-Off Ver
    Excel 2010
    Posts
    779

    Re: Worksheet Change Event < I think

    Can you post a dummy workbook? And also include what you want to achieve?
    If you are happy with the answer, please click the Star icon in the below left hand corner.

    Good sites to start learning.

    snb's VBA Help Files
    Jerry Beaucaires Excel Assistant
    J & R Excel Consultancy Services

    How to post code correctly: Correct Code Posting

  3. #3
    Registered User
    Join Date
    04-19-2010
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: Worksheet Change Event < I think

    I agree with JapanDave a sample workbook would be best. However the only thing to help with your question is for your (byVal Target as Range) line there. Target is a variable that refers to a range object. So you could do anything to Target that you can do to a range. Range("B1").value can be Target.Value. Target.Row, Target.Interior... and so on.
    Excel\Access, VBA, C#, C++, SQL, Java

  4. #4
    Registered User
    Join Date
    10-20-2011
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Worksheet Change Event < I think

    Ok let me explain further.

    I use a trading application that has excel integration and refreshes the worksheet every 100ms.
    I have toggle buttons that link ranges together based on true/false criteria.
    At the moment i have everything working under worksheet_calculate but the problem is the sheet refreshing to quickly on certain rules.
    Hence why i want to link certain aspects to a countdown timer or other slower methods which is where i think i need to use the worksheet change/changeevent.

    Here is an example sheet which at the moment is using the worksheet_calculate.

    I want to link the scanning of these if statements to the countdown timer in "B4" instead of refreshing with everything else each 100ms.

    Hope that makes more sense,

    Beat
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    10-20-2011
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Worksheet Change Event

    Was a Sunday yesterday so i'm assuming this got a bit lost down the list so please dont frown upon this bump.

  6. #6
    Registered User
    Join Date
    10-20-2011
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Worksheet Change Event


  7. #7
    Registered User
    Join Date
    04-19-2010
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: Worksheet Change Event

    Worksheet change I don't think fires until you change the cell. An update from Excel won't do it, but I could be wrong.

    But I'm still a bit confused. You are refresing your sheet 10x a second is that causing a calculation event (thats pretty intense)? I would probably use a MOD(format(NOW(), "unit of choice"), interval of choice) to only do something when the minute is divisible by 15 or something then flag the interval to only run once. It looks for 15/30/45 and only runs it one time, then on the hour it sets it back?? Something like that perhaps?
    Excel\Access, VBA, C#, C++, SQL, Java

  8. #8
    Registered User
    Join Date
    04-19-2010
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: Worksheet Change Event

    Worksheet change I don't think fires until you change the cell. An update from Excel won't do it, but I could be wrong.

    But I'm still a bit confused. You are refresing your sheet 10x a second is that causing a calculation event (thats pretty intense)? I would probably use a MOD(format(NOW(), "unit of choice"), interval of choice) to only do something when the minute is divisible by 15 or something then flag the interval to only run once. It looks for 15/30/45 and only runs it one time, then on the hour it sets it back?? Something like that perhaps?
    Excel\Access, VBA, C#, C++, SQL, Java

  9. #9
    Registered User
    Join Date
    10-20-2011
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Worksheet Change Event

    All i want to do is have excel look at a set of rules each time a certain cell changes value.

    Ive probably made things look more complicated than they are.

    Example

    Cell D10 is a Clock that refreshes automatically every second.

    When it refreshes/changes value then do XYZ

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0