+ Reply to Thread
Results 1 to 3 of 3

Need help with looping issue

  1. #1
    Registered User
    Join Date
    11-01-2011
    Location
    Boca Raton, Florida
    MS-Off Ver
    Excel 2003
    Posts
    21

    Need help with looping issue

    I created a macro with the intent to insert 10 blank lines every 79 rows, then enter some text in those rows, and then force a page break. I want it to loop through all the rows in the file, but it just seems to be looping on the inserting of lines after the initial insertion of blank rows. Please see the macro in the attached file and let me know what I'm doing wrong. The uploaded file shows the correct first loop through. I did comment out the looping statements. You can change them to statements and see the results.

    Thanks, Sharon
    Attached Files Attached Files

  2. #2
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Need help with looping issue

    Try this instead - avoid unnecessary cell selection, works with screenupdating off to for speed, and most importantly, uses a do loop to figure out how many times to loop. Although it was not needed for this project, don't forget you can specify a loop's step size like so
    Please Login or Register  to view this content.
    Here is the code:

    Please Login or Register  to view this content.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  3. #3
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Need help with looping issue

    SDBoca,

    Please read Rule 8 about cross post. You have this same question at


    http://www.teachexcel.com/forum/viewtopic.php?f=6&t=934
    Charles

    There are other ways to do this, this is but 1 !
    Be Sure you thank those who helped.
    IF YOU'RE SATISFIED BY ANY MEMBERS RESPONSE TO YOUR ISSUE PLEASE USE THE STAR ICON AT THE BOTTOM LEFT OF THE POST UNDER THEIR NAME.

+ 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