+ Reply to Thread
Results 1 to 6 of 6

Automatically activate code VBA at change cells from EXTERN data source-without actionUser

  1. #1
    Registered User
    Join Date
    04-10-2013
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    7

    Automatically activate code VBA at change cells from EXTERN data source-without actionUser

    Hi guys,
    I became new user because I have problem.

    Description:
    On List1, cells (A1, B1, C1) I have input cells from extern sources. Cell A1 for extern source1, cell B1 for extern source2, cell C1 for extern source 3. Input data is changing irregurarly. Some time quickly (10-15x per 1sec), some time slowly (1-2x per 1sec). Is possible change A1 will be 2x quickly than B1 (example), sources extern data are independent of each other.

    Main problem is:
    I need synchronize data in time. If change whatever cells (A1 or B1 or C1) - I need capture (copy value and format) of all cells (A1, B1,C1) to other list (List2) or other sheet (I do not care) but I would like the newest data was always in first row.
    Example from Sheet1 List1 A1:C1 copy to Sheet2 List1 A1:C1, before copy new data I would like to moving older data down (select A1 in Sheet2 List1 and insert new first row) then insert cells A1:C1 from Sheet1 List1. Data will be sorted descending in time.
    This is easy... :-)
    BUT
    I need all running automatically, user will be outside PC (no move mouse, no select other cell, no enter,... user is away!)

    Possible way to solution
    Routine Worksheet.Change()
    - I failed me activate... :-( routine requires select other cell but user will be outside PC

    Routine Worksheet.Calculate()
    - I inserted in Sheet1 List1 whatever cells out A1:C1 any formula,
    example cell A2: "=2*A1", B2: "=2*B1" , C2: "=2*C1"
    Why? When change whatever cells A1 or B1 or C1 => automatically activate Worksheet.Calculate().... GREAT! It is my first step to solution... unfortunately - when I insert new first row to Sheet2 List1 doing activate again Worksheet.Calculate()... result is loop code.
    I cannīt solved my task.

    Can you anybody help me, please, write code VBA for my case? My knowledge about VBA programming is poor.
    If is any unclear - ask me.
    Sorry my english.
    Thank you very mutch all!!!
    Best regard, Endy

  2. #2
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Automatically activate code VBA at change cells from EXTERN data source-without action

    You are on the correct path.

    you need to structure the Calculate Event macro to avoid unnecessary looping. Say the data is being feed into Sheet1 and we want the snapshots in Sheet2. Here is a typical macro to do this:

    Please Login or Register  to view this content.
    Gary's Student

  3. #3
    Registered User
    Join Date
    04-10-2013
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Automatically activate code VBA at change cells from EXTERN data source-without action

    Hi, thank you for code. I insert to excel (2003) but nothing... :-( no action. Is it ok? What do I do bad?excel1.png

  4. #4
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Automatically activate code VBA at change cells from EXTERN data source-without action

    Make sure macros are enabled!

  5. #5
    Registered User
    Join Date
    04-10-2013
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Automatically activate code VBA at change cells from EXTERN data source-without action

    :-) some problem on my pc, after restart VBA code is function BUT:
    1.) when change Sheet1 cell A1 manually (cell A2: =2*A1 - activate Worksheet.Calculate() ) - code is run ok! Insert and copy ok.
    2.) after connect extern data - immediate collision, see screen excel2.png
    3.)I tried simulate extern source data from other xls file - see. screen excel3.png

    excel responds very similarly as previous case ad 2.)
    Last edited by endy5; 04-11-2013 at 03:50 PM.

  6. #6
    Registered User
    Join Date
    04-10-2013
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Automatically activate code VBA at change cells from EXTERN data source-without action

    nobody...??? :-( please, help me with write VBA code. Thank you!

+ 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.6.0 RC 1