Results 1 to 8 of 8

Infinite looping problem!!!

Threaded View

  1. #1
    Registered User
    Join Date
    12-11-2013
    Location
    Washington, DC
    MS-Off Ver
    Excel 2007
    Posts
    4

    Infinite looping problem!!!

    I'm currently working on a macro for a client and it involves the use of looping. Essentially what I want to do is find every instance where "EERT OUPUT" header is mentioned in the spreadsheet then rearrange the stacked data below the EERT OUTPUT header into one line or row then proceed to the next EERT OUTPUT header perform the same rearranging activities and so on and so forth. The problem is that the EERT OUTPUT sections aren't sequential AND I have an infinite loop and don't know how to exit. The first EERT OUTPUT header would be in cell A16, the three lines of data (covering about 10 columns) would be provided beneath the header, and then the next EERT OUTPUT header wouldn't be found until cell A112. So about every 100 rows or so the EERT OUTPUT header appears, but varies. I've tried a ton of different things with the VBA, but I think I reached the limitations of my knowledge. Here's the VBA I have:

    Do
    Cells.Find(What:="EERT OUTPUT", After:=ActiveCell, LookIn:=xlValues,_
    LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,_
    MatchCase:=True, SearchFormat:=False).Activate
    ActiveCell.Offset(4,0).Range("A1:N2"). Select
    Selection.Copy
    ActiveCell.Offset(-3,16).Range("A1").Select
    ActiveSheet.Paste
    ActiveCell.Offset(6,-16).Range("A1:M2"). Select
    Selection.Copy
    ActiveCell.Offset(-6,30).Range("A1").Select
    ActiveSheet.Paste
    ActiveCell.Offset(9,-30).Range("A1:K2"). Select
    Selection.Copy
    ActiveCell.Offset(-9,-43).Range("A1").Select
    ActiveSheet.Paste
    Loop
    Also, here's how the spreadsheet is arranged where each letter represents a different data field. I 've provided two additional output groups, but there's probably about 5 or 6 of them. I need to keep the headers, but what I want to do is take the stacked data that is on separate rows and place it on one row. So as you can see the search functionality was used in my macro because the EERT OUTPUT sections are spread out, which makes this macro more complex than your typically loop. So I want to find the first EERT OUTPUT, perform the reorganizing of the data, then move to the next EERT OUTPUT header, perform the same task, and continue until all EERT OUTPUT sections have been reorganized to meet the identified specifications. I also want to be able to continue the macro after exiting the loop and perform additional processes prior to the loop.

    EERT OUTPUT

    A B C D E F G H
    I J K L M N O P
    Q R S T U V W X

    OUTPUT 1
    AB AC AD AE AF
    AG AH AI AJ AL
    AM AN AO AP AQ

    OUTPUT 2
    BC BD BE BF BG
    BH BI BJ BL BM
    BN BO BP BQ BR

    EERT OUTPUT

    A B C D E F G H
    I J K L M N O P
    Q R S T U V W X


    Any help is much appreciated!!!!!
    Last edited by alansidman; 12-11-2013 at 07:49 PM. Reason: code tags added

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. problem in looping
    By katie1987 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-07-2012, 06:49 AM
  2. [SOLVED] Looping Problem
    By Varun13 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-04-2012, 03:02 PM
  3. Looping Problem
    By Spasm in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 07-09-2011, 02:32 PM
  4. Looping problem
    By Sleeping Bear in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-07-2005, 03:05 PM
  5. Looping Problem??
    By tubeboy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2005, 12:21 PM

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