R
Rick
I have this code (thank you very much, really) but I need to modify it a bit.
I only want to copy and paste the first four columns AND I only want the
lines that DO NOT have the word "Hold" in column a:
Sub MoveNotHold()
Dim rngToSearch As Range
Dim rngFound As Range
Dim rngFoundAll As Range
Dim rngPaste As Range
Dim strFirstAddress As String
Set rngPaste = Sheets("Roll").Cells(Rows.Count, _
"A").End(xlUp).Offset(1, 0)
Set rngToSearch = Sheets("Alpha").Range("A1:E99")
Set rngFound = rngToSearch.Find(What:="Hold", _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "There are no items to move."
Else
Set rngFoundAll = rngFound
strFirstAddress = rngFound.Address
Do
Set rngFoundAll = Union(rngFound, rngFoundAll)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFound.Address = strFirstAddress
rngFoundAll.EntireRow.Copy Destination:=rngPaste
'rngFoundAll.EntireRow.Delete 'Optional to Delete
End If
End Sub
I only want to copy and paste the first four columns AND I only want the
lines that DO NOT have the word "Hold" in column a:
Sub MoveNotHold()
Dim rngToSearch As Range
Dim rngFound As Range
Dim rngFoundAll As Range
Dim rngPaste As Range
Dim strFirstAddress As String
Set rngPaste = Sheets("Roll").Cells(Rows.Count, _
"A").End(xlUp).Offset(1, 0)
Set rngToSearch = Sheets("Alpha").Range("A1:E99")
Set rngFound = rngToSearch.Find(What:="Hold", _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "There are no items to move."
Else
Set rngFoundAll = rngFound
strFirstAddress = rngFound.Address
Do
Set rngFoundAll = Union(rngFound, rngFoundAll)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFound.Address = strFirstAddress
rngFoundAll.EntireRow.Copy Destination:=rngPaste
'rngFoundAll.EntireRow.Delete 'Optional to Delete
End If
End Sub