+ Reply to Thread
Results 1 to 13 of 13

Capturing a temporary value

  1. #1
    Registered User
    Join Date
    11-08-2010
    Location
    Amsterdam, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    7

    Capturing a temporary value

    Hi,

    Although I can work reasonably wel with excel, I cannot program in VBA.
    The probem is this:

    A value appears in a cell for +/- 1 second. What I would like to do is capture this value and
    copy it to another cel. I have multiple cells where I would like to do this.
    Can anyone help?

    Thanks in advance.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Capturing a temporary value

    Where does the value come from?


    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    11-08-2010
    Location
    Amsterdam, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Capturing a temporary value

    Gladly, but as I cannot duplicate the source of the data( Gruss software Betting assistant) I can only hope it makes sense. The data in the spreadsheeet is actively "called" from this piece of software and constantly changing.
    I will explain some more:
    I start Gruss software Betting assistant and make a link to Betfair to recieve the data from a certain race.
    I make a link to excel from the Betting assistant and all relevant data is dynamically shown in the spreadsheet.
    In cell A3 the time to the beginning of the race is shown. Because it is counting down to 0, it is constantly changing.
    Now I would like to (permanently) place the contents of cell A5(the going rate) in 4 different cells, corresponding with the times mentioned hereunder.
    I would like to do this at T-30, T-20, T-10 and T-1 (ie 30 minutes before the start of the race, 20 mins, 10mins and 1 minute.
    A5 is also dynamically changing.
    Does this help?

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Capturing a temporary value

    You may have some success with the Worksheet_Change sheet event. Each time the sheet changes, this macro would check the value of the timer and at certain moments transfer the values to the appropriate reference cells.

    1) Right-click the sheet tab and select VIEW CODE to open the sheet module
    2) Paste in this code:
    Please Login or Register  to view this content.
    3) Close the editor
    4) Save as a macro-enabled workbook

    Obviously the code is a "guess" since I can't see your workbook. You'll need to adjust the "CASE" statements to properly reflect the values from A3 that should trigger the copy command.

    Also, edit the copy commands, I just used J1:J4 as an example.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Registered User
    Join Date
    11-08-2010
    Location
    Amsterdam, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Capturing a temporary value

    Thank you very much.
    due to the time difference I have yet to try it.
    But I will get back to you.

  6. #6
    Registered User
    Join Date
    11-08-2010
    Location
    Amsterdam, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Capturing a temporary value

    You wrote: You'll need to adjust the "CASE" statements to properly reflect the values from A3 that should trigger the copy command.

    I have no success doing this.
    I replace the 30 for example with 0.0208333333333 (the native excel time notition).
    This has to be compared with cell A3. A3 also shows the native excel time notition.
    At the moment they correspond the value in cell A5 has to be captured and placed in J1-J4, (in our example above).
    Unfortunately nothing is captured.
    Any suggestions?

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Capturing a temporary value

    I have nothing to look at so I can't guess what's wrong. Click GO ADVANCED and use the paperclip icon to post up a desensitized copy of your workbook.

  8. #8
    Registered User
    Join Date
    11-08-2010
    Location
    Amsterdam, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Capturing a temporary value

    I have included a static copy of the spreadsheet.

    These are the times at which a snapshot of F5 must be made:

    T-30 0,020833333
    T-25 0,017361111
    T-20 0,013888889
    T-15 0,010416667
    T-10 0,006944444
    T-5 0,003472222
    T-3 0,002083333
    T-1 0,000694444

    In F19 I have a formula which will show the contents of F5, bu only temporarily.
    I am looking forward to reading your reply.
    Attached Files Attached Files

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Capturing a temporary value

    This is how I guess I would do that:

    Please Login or Register  to view this content.

    This is just to give you the idea. You may need to adjust the ranges and the cells being copied. I just used F5 because you highlighted it.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    11-08-2010
    Location
    Amsterdam, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Capturing a temporary value

    Hi, thank you for your solution, it works wonderfully!
    I have pasted my variation below.
    I do have a question though:
    A fault message is generated when all the values have been filled in.
    The debugger wants to debug: MyTime.....???
    Any ideas?
    Once again thanks.


    Please Login or Register  to view this content.
    Last edited by metalrat; 11-17-2010 at 06:00 PM.

  11. #11
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Capturing a temporary value

    As per the Forum Rules please edit the post above and put code tags around the code (like in my posts above).

  12. #12
    Registered User
    Join Date
    11-08-2010
    Location
    Amsterdam, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Capturing a temporary value

    As requested.

  13. #13
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Capturing a temporary value

    I you provide your sample workbook again with your edited code, then post that with instruction on how to duplicate the error situation, I'll take a look at it directly.

+ 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