View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bruccce Bruccce is offline
external usenet poster
 
Posts: 20
Default Moving a row based on content of a cell to a diff worksheet

I would like to move a row to a different worksheet. I have come across the
following code to delete a cell. Can it be modified or is there a better
way....

Thanks
Bruce

_________________
Sub DeleteRowsContaining()
Dim r As Long
Dim ans As String
Dim c As Range
Dim lrow As Long

ans = InputBox("What string do you want rows to be deleted if they contain
it?")
Application.ScreenUpdating = False

lrow = ActiveSheet.UsedRange.Row - 1 + _
ActiveSheet.UsedRange.Rows.Count
For r = lrow To 1 Step -1
With Cells(r, 1)
Set c = .Find(ans, LookIn:=xlValues)
If Not c Is Nothing Then
.EntireRow.Delete
End If
End With
Next r
Application.ScreenUpdating = True

End Sub