+ Reply to Thread
Results 1 to 3 of 3

New to VBA programming and need help to Optimize VBA code

  1. #1
    Spammer
    Join Date
    11-21-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    387

    New to VBA programming and need help to Optimize VBA code

    Good Evening...

    I am very new to VBA... have only been playing with it for about a week, and need to help to optimize a macro.

    Currently it takes about 23 seconds for it to run... and was hoping to get it down a bit.

    First step is a push button to "select file location" then one table from the DB is downloaded into a worksheet called "hidden" and finally columns B:L are copied from "hidden" to "UPS Tariff"

    Any suggestions are greatly appreciated
    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    01-08-2016
    Location
    Cagayan De Oro City, Philippines
    MS-Off Ver
    2013
    Posts
    152

    Re: New to VBA programming and need help to Optimize VBA code

    Hi

    First thing i would do is

    1.
    Change adOpenStatic to adOpenForwardOnly, im not sure if this applies to reading data from a file but it certainly slows things down with a live database connection

    2.
    your looping through every cell in 'Sheet9.Range("B1:B762")' and checking that they dont contain all those values and multiplying it by 1!!!!!!!! is this correct?

    this looks very slow, examine the code here and make these changes....
    Please Login or Register  to view this content.
    just try that first and post back here.

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,271

    Re: New to VBA programming and need help to Optimize VBA code

    Avoid Select and Selection in your code. It's unnecessary and slows down your code. Use With ... End With instead.

+ 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. Optimize a code
    By pezalmendra in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-06-2015, 05:31 PM
  2. Optimize code
    By DarkKnightLupo in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 02-19-2014, 08:58 AM
  3. Optimize a slow code...
    By benoitly in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-02-2013, 01:44 PM
  4. optimize the Code needs to run faster
    By farrukh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-24-2012, 10:40 AM
  5. Optimize code
    By miso.dca in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-08-2011, 03:35 PM
  6. Optimize Alphabetizing VBA Code
    By NewExcelUser in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-29-2010, 11:51 PM
  7. Optimize VBA code
    By doodlebug in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-22-2007, 07:53 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