+ Reply to Thread
Results 1 to 7 of 7

Execute Cell with a Macro (timer)

  1. #1
    Registered User
    Join Date
    04-06-2006
    Posts
    24

    Execute Cell with a Macro (timer)

    Hi
    I am learning guitar and I felt that if I use random chord names by using a timer say 10 seconds to auto change the chord in Excel, I could increase my speed of changing chords. I have list of chords in A1:A17 and this formula =INDEX(A1:A17,RANDBETWEEN(1,COUNTA(A1:A17))) entered in C1.
    What I want is a Macro with a timer to run the above formula every 10 seconds and auto change the chord in cell C1. The macro to include Start and Stop button, if possible.
    Let me know where to insert the macro in the workbook.
    Any help would be appreciated.
    Thanks
    FLDS

    Note: I have posted this same request in Mr Excel forum, NO replies
    Last edited by flds; 05-13-2010 at 07:27 AM.

  2. #2
    Valued Forum Contributor mdbct's Avatar
    Join Date
    11-11-2005
    Location
    CT
    MS-Off Ver
    2003 & 2007
    Posts
    848

    Re: Execute Cell with a Macro (timer)

    In Sheet1's module the folllowing is assigned to a button called StartStop
    Please Login or Register  to view this content.
    In a standard module:
    Please Login or Register  to view this content.
    I've attached a sample book.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    04-06-2006
    Posts
    24

    Re: Execute Cell with a Macro (timer)

    Hi Mdbct,
    Thank you for your time to help me. This is exactly what I wanted, But your added feature of the count in column 5 was great. I did not think of this.

    I have a small request, is it possbile to have an input box on sheet1 to enter the time (i.e. seconds value 10), [Application.OnTime Now() + TimeSerial(0, 0, 10), "refreshIt" ]
    Instead of going into the code and changing it.
    As I improve my playing speed, I would like to decrease the time.

    I hope, I have explained this well.

    Thanks once again, I truely appreciate your help.

    FLDS

  4. #4
    Valued Forum Contributor mdbct's Avatar
    Join Date
    11-11-2005
    Location
    CT
    MS-Off Ver
    2003 & 2007
    Posts
    848

    Re: Execute Cell with a Macro (timer)

    I'm glad you liked my unintentional added feature. It was left over from my testing - I had meant to remove that part.

    I've attached an updated version that uses a textbox to vary the interval. For ease of use (less clicking), I would considered using a designated cell (E5 in this sheet's case - the yellow one on the sheet) for entering the variable time.

    The new code:
    Please Login or Register  to view this content.
    I've highlighted (in bold but it's hard to tell) the two lines for the assigning of the variable time. Currently the textbox controls the time while the other line is commented out
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    04-06-2006
    Posts
    24

    Post Re: Execute Cell with a Macro (timer)

    Hi Mdbct,

    Thanks for your reply, appreciate your help.

    I have attached the file which I modified to look a bit impressive. (your comments)

    1. One issue on this file is, in the filed "Enter Interval Time Here" when I leave this blank or type a 0 (zero) it continuously runs and cannot be stopped until I press Esc and a "end,Debug window pops up. It starts again.

    2. I am unable to protect the file (sheet) to save it from misuse.

    If you are able to fix this it would be great.

    I am happy and I love this program you created for me. Thanks so much.

    FLDS
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor mdbct's Avatar
    Join Date
    11-11-2005
    Location
    CT
    MS-Off Ver
    2003 & 2007
    Posts
    848

    Re: Execute Cell with a Macro (timer)

    Changes:
    1) Sheet is now protected - password is your user name (flds)
    2) Interval textbox must be a number (greater than zero) and not a blank entry
    3) When the button is clicked, the sheet is unprotected at each interval, the changes occur and the sheet is re-protected.
    4)"Reset this Counter" is now a transparent button, click on it to reset the counter instead of clearing the cell (which you cant do since the sheet is protected).
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    04-06-2006
    Posts
    24

    Re: Execute Cell with a Macro (timer)

    Hi mdbct,

    Thanks for the fix. You did what I did not expect in this program, this is wonderful, I hope some day I will be able to play my guitar.

    Thanks once again.

    FLDS

+ 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