Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Mar 2005
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Slow Macro (Excel 2002)

    I have a quick question. I have a big macro that is formating and creating another file and it is running really slow. I can watch the file type. Am I missing something in my code? I know some of the lines are repeats. I recorded the macro and I am afraid to mess with the code.

    Thanks!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Slow Macro (Excel 2002)

    It is a very inefficient macro because it keeps on selecting ranges. That's not your fault - it's the way the macro recorder works.

    There seems to be a lot of unnecessary code in there - setting borders and fonts etc. If you can explain what you want the macro to do, it can probably be shortened considerably.

  3. #3
    Lounger
    Join Date
    Mar 2005
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Slow Macro (Excel 2002)

    I have a database that is exported into excel. I format and use the file for a monthly client mailing. This is a second step that I am doing to create a script from the exported data that I can use to run the client reports from my operating system. So I need a text file that has the correct format and order that can be read. What code can I use to clean this up?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Slow Macro (Excel 2002)

    Without seeing the data you're cleaning up it's hard to say, but the macro contains repeated setting of fonts and borders. Wouldn't it be possible to set those in one go?

  5. #5
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Slow Macro (Excel 2002)

    The last few lines of that code look familiar. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    That macro looks like it has a lot of unnecessary and inefficient code in it (that is normal in recorded macros). However, without seeing the worksheets that it is working on, it is very difficult to say what is and is not necessary and what is a better more efficient way to do it. Is there any chance you could post a stripped down version of the workbook, with the data as it would be before the macro is run, and with any confidential data modified? Without that, there is no way that we can test any changes we make.
    Legare Coleman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •