+ Reply to Thread
Results 1 to 7 of 7

a faster, more efficient way for this math loop

  1. #1
    Registered User
    Join Date
    07-01-2018
    Location
    Houston, TX.
    MS-Off Ver
    Office 365
    Posts
    93

    Post a faster, more efficient way for this math loop

    I have this in worksheet _change , and seek assistance in making this code more efficient / faster. It calculates a balance from the previous sheet and places it in "J" of the current sheet. Thanks in advance

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    11-26-2012
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    419

    Re: a faster, more efficient way for this math loop

    Is there a reason you are using VBA for this, and not formulas?

    Looking at the code, I don't see what could be taking any significant amount of time - how long does it take?

  3. #3
    Registered User
    Join Date
    07-01-2018
    Location
    Houston, TX.
    MS-Off Ver
    Office 365
    Posts
    93

    Re: a faster, more efficient way for this math loop

    I have not timed it, wanted another set of eyes on it, I would like the cell's(J) value when at 0 to allow another Beginning value, it is a running balance. I had used a formula, but that means the cell must be locked, then unlocked ... etc., so the easiest way for me to overcome was do the math in VBA. Cell stays unlocked & when balance hits 0 I am able to start a new total.

    This is only part of the code in the worksheet_change event, I can post all of it if you want to have a look.
    Last edited by dad812; 08-14-2018 at 08:37 PM. Reason: more information

  4. #4
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: a faster, more efficient way for this math loop

    yes post the whole code.
    or better yet - post a sheet with any sensitive information removed.
    Also if you can time it on your system and tell us what "slow" is. For me this seems fast - but maybe your other code is causing a lot of looping or something?
    If you want something done right... find a forum and ask an online expert.

    Time flies like an arrow. Fruit flies like a banana.

  5. #5
    Registered User
    Join Date
    07-01-2018
    Location
    Houston, TX.
    MS-Off Ver
    Office 365
    Posts
    93

    Re: a faster, more efficient way for this math loop

    This is all the code I have in the sheets, Worksheet_Activate() & Worksheet_Change, I need the cells to update based on cell value change - in order to get desired results I need to run in both events. And are you asking for the workbook with only a couple of sheets in it ? it may not be until tomorrow. thanks for looking

    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor
    Join Date
    11-26-2012
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    419

    Re: a faster, more efficient way for this math loop

    Please Login or Register  to view this content.
    That is an interesting way to get the row - hope you never have more than a 100

    This may be what you were looking for:
    Please Login or Register  to view this content.
    Do you need to Enable Events where you do? If you put it along with the Application.ScreenUpdating = True, that should speed things up.

  7. #7
    Registered User
    Join Date
    07-01-2018
    Location
    Houston, TX.
    MS-Off Ver
    Office 365
    Posts
    93

    Re: a faster, more efficient way for this math loop

    I'll make those suggestions happen (mgs73) and check out the results. Had an issue early on in doing the math after mouse click - it was the current row vs target row, wasn't going to let it win.

    would you still like me to upload a copy of the spreadsheet ? (scottiex) and thx...

+ 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. [SOLVED] Make this code more efficient and faster
    By SIMBAtheCAT in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-30-2014, 10:45 AM
  2. [SOLVED] Make a macro more efficient/faster
    By jhonneyboy in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 06-25-2014, 05:38 PM
  3. [SOLVED] Need Help Making Macro Faster/More Efficient
    By rbac in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-09-2013, 10:52 AM
  4. [SOLVED] Sumproduct - formula more efficient/faster?
    By Gti182 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-17-2013, 07:45 AM
  5. [SOLVED] More efficient (faster) sub-String method?
    By Bytor47 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-12-2013, 08:40 AM
  6. [SOLVED] More efficient and faster way to delete Rows?
    By nironto in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-07-2013, 05:01 AM
  7. [SOLVED] Edit code to be faster, more efficient.
    By rocksan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-15-2012, 02:45 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