+ Reply to Thread
Results 1 to 7 of 7

simplify code

  1. #1
    Registered User
    Join Date
    05-22-2010
    Location
    Greenville, SC
    MS-Off Ver
    Excel 2007
    Posts
    12

    simplify code

    I would love to simplify this code. It is extremely long and I have to have 3 macros to complete the full need for what I am doing. It is very repetative. I am inserting 6 rows between the information that I have on my data sheet. However, I now have the need for a 7th row to be added and do not want to have to go back through and manually edit every number if I can help it.

    Please Login or Register  to view this content.
    Thank you so very much.
    Last edited by double a enterprises; 07-04-2010 at 02:35 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Could I get my code simplified also?

    I]Your post does not comply with Rule 1 of our Forum [/I]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.
    Hope that helps.

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

    Free DataBaseForm example

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: simplify code

    I believe your title is accurate (shorter code is your goal) so hopefully the change you made is acceptable.

    Play with this and see if you can get it to do what you want:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    05-22-2010
    Location
    Greenville, SC
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: simplify code

    I have been messing with the code that was given to me and I am not sure how exactly to make it work. It shows an error code with everything I have been trying.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: simplify code

    Post up your sample workbook with a couple of sheets showing BEFORE and AFTER so we can look at it together.

    Click GO ADVANCED and use the paperclip icon to post up a desensitized copy of your workbook.

  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: simplify code

    I think this will do the trick:

    Please Login or Register  to view this content.

  7. #7
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: simplify code

    Your code and request indicates that you want to insert 7 rows between every row in your data

    If this is correct then
    Please Login or Register  to view this content.

    However
    It might be an idea to also try this as a more general approach
    Please Login or Register  to view this content.

    Called like this
    Please Login or Register  to view this content.

    This reads as

    InsertRows:= beginning with row 4, insert 7 rows between each row of data, do this 18 times.

    You can therefore add however many rows as you wish between each row of data
    e.g.
    Please Login or Register  to view this content.
    inserts 5 rows 20 times


    Hope this helps
    Last edited by Marcol; 07-05-2010 at 05:51 AM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

+ 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