ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Loop Statment help! (https://www.excelbanter.com/excel-programming/288016-loop-statment-help.html)

pete

Loop Statment help!
 
Can some one tell me how to set up this code as a loop
statment so I only have to preform the funtion once and
the code will preform until the last row of my range has
been moved.

here is the code I have.

Sub MoveUSDown()

Application.ScreenUpdating = False


ActiveCell.Name = "MoveUS1"
Cells.Find(What:="Totals in USD:",
After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False).Activate
Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Offset(0, 3).Range("A1").Select
ActiveCell.Name = "MoveUS2"
Range("MoveUS1:MoveUS2").Select
Selection.Cut Destination:=ActiveCell.Offset(1, 0)
Range("W3").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-21]=RC[3],""Y"",IF(RC
[3]="""",""A"",""""))"
Range("W3").Select
Selection.AutoFill Destination:=Range("W3:W219")
Range("MoveUS2").Select
ActiveWorkbook.Names("MoveUS2").Delete
Range("MoveUS1").Select
ActiveWorkbook.Names("MoveUS1").Delete
ActiveCell.Offset(-1, -3).Range("A1").Select
Selection.ClearContents

End Sub

In my code I put a Y,A or blank in the cell across from my
list to let me know which cells have to be moved next. If
we don't need that please feel free to take it out.

Thanks for any help.
Pete

Etien[_12_]

Loop Statment help!
 
to be honest Pete, I don't understand what your macro does! Can you mai
me the file it operates on (if it's not too large), I think this shoul
help.
--
Message posted from
http://www.ExcelForum.com



All times are GMT +1. The time now is 06:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com