+ Reply to Thread
Results 1 to 3 of 3

Can I Improve This Code?

  1. #1
    Registered User
    Join Date
    10-25-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    34

    Can I Improve This Code?

    Hey guys,

    I've made a macro that works perfectly, but I'd like to improve the code (for educational purposes).

    I've got a macro that sets a filter to a value in a cell, then copies the range to a sheet with the same name as the filter. I've set up variables for each cell, but I want to loop through the copy rather than repeating it.

    Instead of repeating the code and changing Group1 to Group2, how can I use a loop to do this?

    Thanks,
    Lucas

    P.S Code below

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Can I Improve This Code?

    It was challenging to tell what you were really trying to accomplish with all the "Selections" as it gives us no reference. Try this and let me know how close i got:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-25-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Can I Improve This Code?

    Hey stnkynts,

    Great response mate. Although the code didn't quite work, I wasn't after a functioning bit of code anyway. What you demonstrated perfectly was the syntax of how to set the variables and loop through them. Now I can recreate my code with this technique. Not to mention can appropriate it for other uses!

    Thanks! Thread marked as solved

    Lucas

+ 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. Improve my code: If, or, then
    By Alex532 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-01-2013, 07:19 PM
  2. [SOLVED] To improve Efficiency of code, code running too long
    By andywsw in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-19-2012, 05:54 PM
  3. [SOLVED] Anyone help to improve my code?
    By Andrew in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-05-2006, 10:15 AM
  4. Re: Improve code
    By rjamison in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-13-2005, 08:05 PM
  5. Improve code
    By Gareth in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-20-2005, 11:06 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