ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with Loopas (https://www.excelbanter.com/excel-programming/421060-help-loopas.html)

[email protected]

Help with Loopas
 
I deal with a spreadsheet that has a list in a column. (On each row
in the column) You can select either open or closed. I wanted to do
some sort of Loop whereby If the word Closed (could use a "Find"
function?) in that particular row in column F then I would like to cut
that row and paste it into another workbook then delete the old row.

Thanks

[email protected]

Help with Loopas
 
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 09/12/2008 by AXUKLSLAV
'

'
Columns("F:F").Select

For Each Row In Columns("F:F")

Find(What:="closed", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

'FindNext(After:=ActiveCell)Activate

Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Cut
Sheets("Completed Tasks").Select
Range("A2").Select
ActiveSheet.Paste
Range("A3").Select


End Sub


??? Help plz

[email protected]

Help with Loopas
 
On Dec 9, 6:49*pm, wrote:
I deal with a spreadsheet that has a list in a column. *(On each row
in the column) You can select either open or closed. *I wanted to do
some sort of Loop whereby If the word Closed (could use a "Find"
function?) in that particular row in column F then I would like to cut
that row and paste it into another workbook then delete the old row.

Thanks



Per Jessen

Help with Loopas
 

Hi

Try this:

Sub MoveClosedRows()
Dim LastRow As Long
Dim r As Long
Dim off As Long
Application.ScreenUpdating = False
LastRow = Range("F" & Rows.Count).End(xlUp).Row
For r = LastRow To 2 Step -1 ' Headings in row 1
If Cells(r, "F").Value = "Closed" Then
Rows(r).Copy Destination:=Sheets _
("Completed Tasks").Range("A2").Offset(off, 0)
Rows(r).Delete
off = off + 1
End If
Next
Application.ScreenUpdating = True
End Sub

Regards,
Per

skrev i meddelelsen
...
On Dec 9, 6:49 pm, wrote:
I deal with a spreadsheet that has a list in a column. (On each row
in the column) You can select either open or closed. I wanted to do
some sort of Loop whereby If the word Closed (could use a "Find"
function?) in that particular row in column F then I would like to cut
that row and paste it into another workbook then delete the old row.

Thanks




All times are GMT +1. The time now is 08:10 PM.

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