+ Reply to Thread
Results 1 to 5 of 5

Best way to 'tweak' my code?

Hybrid View

hutch@edge.net Best way to 'tweak' my code? 03-28-2008, 08:39 PM
Kim_J I don't know if this is the... 03-28-2008, 08:48 PM
mudraker If you are not sure on... 03-28-2008, 10:01 PM
hutch@edge.net Good Tips 03-29-2008, 09:21 AM
royUK generally it's fine to remove... 03-29-2008, 10:10 AM
  1. #1
    Valued Forum Contributor
    Join Date
    03-23-2008
    Location
    Tennessee
    MS-Off Ver
    Office 2007
    Posts
    706

    Best way to 'tweak' my code?

    I've finally finished a complex (for me) workbook, and have it working the way it's supposed to. The only problem is slow start, save and close times, and I'm suspicious this is probably due to less than efficient code. (Most of my macros are recorded, with ssome editing help from the nice people in this forum.

    Now I want to go back in and edit the macros to clean them up as much as possible. What's the best way to do this? Should I just put a ' at the beginning of the lines i'm not sure about, so Excel doesn't read it as code, and then try to run it to see what happens? Are therre code editors that will search for unnecessary items?

    Any suggestions would be appreciated.

    Thanks in advance.

    Jerry

  2. #2
    Registered User
    Join Date
    03-26-2008
    Posts
    45
    I don't know if this is the best way, someone more familiar with VBA might have a better answer but one thing I do after I record macros is go in and delete all of the lines where I am just scrolling my mouse, or where I messed up and did something I didn't need to do.

  3. #3
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    If you are not sure on editing your code then 1 way to improve it is to post a copy here for soemone to look at and offer suggestions.

    These links offers some suggestions for speeding up code
    http://www.cpearson.com/excel/optimize.htm
    http://www.ozgrid.com/VBA/SpeedingUpVBACode.htm
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  4. #4
    Valued Forum Contributor
    Join Date
    03-23-2008
    Location
    Tennessee
    MS-Off Ver
    Office 2007
    Posts
    706

    Good Tips

    Great tips on those pages for noobs like me. The addition of "Application.ScreenUpdating = False" was a HUGE performance enhancer!

    I'll study and apply the tips from those two pages.

    Thanks bunches!

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    generally it's fine to remove any Select commands as they are unnecessary so , e.g.

    MyRange.Select
    MyRange.Copy
    Xhange to

    MyRange.Copy
    Hope that helps.

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

    Free DataBaseForm example

+ 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