LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Martin
 
Posts: n/a
Default DoUntil VB command

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF Command conditional formating IDCrewDawg Excel Worksheet Functions 7 September 8th 05 04:19 PM
Excel 2003 - Toolbar missing the file command Monty29 Excel Discussion (Misc queries) 2 September 5th 05 04:03 PM
Extract Command in Excel 1 Bethetsu Excel Discussion (Misc queries) 1 May 12th 05 02:19 PM
Help requested for an Excel Toolbar command Deanl5 Excel Discussion (Misc queries) 2 January 17th 05 01:01 AM
command button in excel will move when print. [email protected] Excel Discussion (Misc queries) 1 December 29th 04 03:53 PM


All times are GMT +1. The time now is 03:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"