Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
Hi there,
I have recorded a macro that does a search and then copies data from one cell to another. I want it to loop until it finds the last occurrance of the search parameter. I understand that there is a VB command "DoUntil"? What would I put after this please? How do I make it loop? This is my macro: Sheets("Book1").Select Application.Goto Reference:="R1C1" Cells.Find(What:="sub", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _ xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _ , SearchFormat:=False).Activate ActiveCell.Offset(-2, 0).Range("A1").Select Selection.Copy ActiveCell.Offset(2, 0).Range("A1").Select ActiveSheet.Paste ActiveCell.Offset(-2, 6).Range("A1").Select Application.CutCopyMode = False Selection.Copy ActiveCell.Offset(2, 0).Range("A1").Select ActiveSheet.Paste ActiveCell.Offset(0, -6).Range("A1:G1").Select ActiveCell.Activate Selection.Copy Sheets("Book1NEW").Select Application.Goto Reference:="R60000C1" Selection.End(xlUp).Select ActiveCell.Offset(1, 0).Range("A1").Select ActiveSheet.Paste ActiveCell.Offset(0, 4).Range("A1:C1").Select Application.CutCopyMode = False Selection.Cut Destination:=ActiveCell.Offset(0, -3).Range("A1:C1") ActiveCell.Offset(0, -3).Range("A1:C1").Select Sheets("Book1").Select End Sub Thanks in advance, Martin |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
IF Command conditional formating | Excel Worksheet Functions | |||
Excel 2003 - Toolbar missing the file command | Excel Discussion (Misc queries) | |||
Extract Command in Excel 1 | Excel Discussion (Misc queries) | |||
Help requested for an Excel Toolbar command | Excel Discussion (Misc queries) | |||
command button in excel will move when print. | Excel Discussion (Misc queries) |