dpalmer013
New Member
- Joined
- Dec 11, 2013
- Messages
- 6
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. 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
I also want to be able to continue the macro after exiting the loop and perform additional processes prior to the loop.
Any help is much appreciated!!!!!
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
I also want to be able to continue the macro after exiting the loop and perform additional processes prior to the loop.
Any help is much appreciated!!!!!