Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default 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


Reply
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



All times are GMT +1. The time now is 12:54 PM.

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

About Us

"It's about Microsoft Excel"