+ Reply to Thread
Results 1 to 3 of 3

Help to finish loop program in Worksheets

  1. #1
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Brazil
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    268

    Help to finish loop program in Worksheets

    Hello,

    I have attached a spreadsheet that contains the code on Module named PROGRESSReadingExcelFile(Sub ReadExcel). Basically, it copies the data on Worksheet: "Sheet1", when column B has the name TOT in it and then copy its contents right after TOT, after 6 lines. For example, when it finds TOTXPTO, it copies data from C10 to H11 into Worksheet TOTXPTO.
    It is copying correctly but when the loop ends I get an error because I am doing a loop in worksheets and when it goes to last loop the worksheet Index is set to a number that does not exist. If you open the code, it should be easier to understand. There might be a way do deal with loop in Worksheets that avoid that condition?

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Help to finish loop program in Worksheets

    Please Login or Register  to view this content.
    is looping from 4 until the lastrow, but you only have 3 sheets
    if you include exit line, it may work
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Brazil
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    268

    Re: Help to finish loop program in Worksheets

    Thanks AB33!!

+ 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. [SOLVED] Printing a userform and displaying a chart upon finish VBA program
    By damayn83 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-12-2013, 12:55 PM
  2. program with loop
    By jnm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-20-2012, 07:41 AM
  3. lines in loop don't execute when program is run
    By akaron in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-23-2012, 11:02 AM
  4. Replies: 5
    Last Post: 06-20-2012, 05:19 AM
  5. Replies: 2
    Last Post: 03-05-2011, 01:25 AM

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