+ Reply to Thread
Results 1 to 1 of 1

Optimize Code, Running Slowly

  1. #1
    Forum Contributor
    Join Date
    03-30-2016
    Location
    Gillette, WY
    MS-Off Ver
    Office 365
    Posts
    230

    Optimize Code, Running Slowly

    Hello,

    The attached VBA project is used to enter customer orders for flats of annual flowers. In the "Flower Order Entry" tab, the user selects varieties of flowers from drop-down menus in Column T under "Common Name." The colors available for each variety are then highlighted green in columns U thru AR based on the saved colors for each variety in the "Data" tab. The user then enters how many flats of each color are to be ordered. Finally, the code compiles a summary of the order in columns L thru O.

    My code is providing the intended result but after about 5 varieties are entered, the code runs very slowly. There are several nested loops that are used to compile the order summary that, I imagine, could be optimized but I am not sure how. I am looking for suggestions and guidance on how to optimize this code to run more efficiently. I imagine that I am recalculating variables a lot more often than I need to but I am not familiar enough with using public variables to use them confidently. I have been using VBA off and on for a few years now but and I have other versions of this project but they are not as dynamic as I need them to be. My relevant code is below:

    Public Functions lrFind and cntUnique are used to evaluate the saved varieties and colors in the "Data" tab to define and resize various ranges and compile a list of unique colors available in the "Flower Order Entry" tab:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Worksheet_Change Procedure every time the user enters or changes a value in the Order Entry table:
    Please Login or Register  to view this content.
    Module 1 Sub to Update the Order Summary in Columns L thru O:

    Please Login or Register  to view this content.
    Thank you all, in advance, for any help.
    Attached Files Attached Files

+ 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. Code running v slowly when Called from another Macro
    By theo499 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-05-2019, 10:39 AM
  2. Help my code is running very slowly..
    By wishmaker in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-06-2014, 06:03 AM
  3. VBA Code is running really slowly
    By behrensf84 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-07-2014, 06:06 PM
  4. Code running really slowly
    By The Phil in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-03-2014, 08:42 PM
  5. [SOLVED] Code running slowly
    By Sweepin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-30-2013, 09:15 PM
  6. Code running slowly
    By rhudgins in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 02-01-2011, 11:08 AM
  7. [SOLVED] Paste code running extremely slowly...
    By KR in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-03-2005, 11:05 AM

Tags for this Thread

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