+ Reply to Thread
Results 1 to 9 of 9

Shorten a lengthy code

  1. #1
    Registered User
    Join Date
    08-12-2012
    Location
    Gold Coast
    MS-Off Ver
    Excel 2010
    Posts
    31

    Shorten a lengthy code

    Hi,
    Is there anybody out there that can help solve this???? I need advice if there is a quicker way to complete this sub.

    Please Login or Register  to view this content.
    Last edited by Pyro Form; 08-27-2012 at 01:37 AM.

  2. #2
    Registered User
    Join Date
    08-13-2012
    Location
    Newark, DE
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: Is there an easier way to do this?

    You can find some good advice here on how to speed up your code. Pay special attention to the section on avoiding the use of copy and paste.
    http://www.mrspreadsheets.com

  3. #3
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Is there an easier way to do this?

    Try this, make a back up copy your workbook and paste this in place of your code.
    Please Login or Register  to view this content.
    Last edited by JapanDave; 08-26-2012 at 12:17 AM.
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  4. #4
    Registered User
    Join Date
    08-12-2012
    Location
    Gold Coast
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Is there an easier way to do this?

    Thanks Dave, Can you add a bit of running commentary on what each command represents? I just need to understand what the code is requesting.

  5. #5
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Is there an easier way to do this?

    Did it work ok? That was completely untested code.

    Here is a little explanation.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-12-2012
    Location
    Gold Coast
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Is there an easier way to do this?

    No, it didn't work. Your code just copies all names in Range A from the Today sheet.

  7. #7
    Registered User
    Join Date
    08-12-2012
    Location
    Gold Coast
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Is there an easier way to do this?

    This cannot be to hard to solve?

  8. #8
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Is there an easier way to do this?

    Time to post a sample workbook with the out come you want.

  9. #9
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Is there an easier way to do this?

    Actually, it's time to give your thread an acceptable title.

    @ Pyro Form

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.


  10. #10
    Registered User
    Join Date
    08-12-2012
    Location
    Gold Coast
    MS-Off Ver
    Excel 2010
    Posts
    31

    Shorten a lengthy code

    Hi,

    I will be more precise (sorry but I thought everyone can read my mind ) . I am not sure if it is possible to shorten the lengthy code as shown in my first post in this thread. My objective is to select names in listbox1 and the value (job number) in combobox2 relates the names to the corresponding worksheet (with the same job number). The code I have written above works but instead of writing a lengthy code I am sure there must be a shorter version?
    Last edited by Pyro Form; 08-27-2012 at 01:52 AM.

  11. #11
    Registered User
    Join Date
    08-12-2012
    Location
    Gold Coast
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Is there an easier way to do this?

    Hi Dave,
    Thanks for your contribution thus far. I do not wish to attach a workbook at this stage due to my progress of this program.

    I will persevere and see if others can solve my predicament.

    Regards
    TR

  12. #12
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Is there an easier way to do this?

    why not set up a dummy book with just a few sheets, say "380" until "382" with the today sheet, then throw in some bogus data, then explain how you wanted it parsed. It would not be very hard and you may get a better solution, as I am just going off your macro, which BTW seems to always copy the cell from row A on the today sheet.
    Last edited by Cutter; 08-27-2012 at 09:38 AM. Reason: Removed whole post quote

+ 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