Cut Contents and Paste
Hi
Look at this:
Sub CutContentsandPaste()
Dim wsA As Worksheet
Dim wsB As Worksheet
Dim LastRow As Long
Dim off As Long
Set wsA = Worksheets("Sheet1") ' Change to suit
Set wsB = Worksheets.Add
wsA.Activate
LastRow = Range("A" & Rows.Count).End(xlUp).Row
off = 0
For r = LastRow To 1 Step -1
If Range("A" & r).Value = "ZRP3" Then
Range(Cells(r, "A"), Cells(r, "L")).Cut
Destination:=wsB.Range("A1").Offset(off, 0)
End If
Next
End Sub
Regards,
Per
"MCheru" skrev i meddelelsen
...
I am trying to create a macro that will search every cell in Column A for
ZRP3 when it finds these contents cut the entire row it exists in up to
column L, and paste all the rows that got copied into a new worksheet.
This
what I have written so far but its not quite doing the job
Sub CutContentsandPaste()
Range("A1").Select
ActiveCell.FormulaR1C1[-1]= "ZRP3"
Range("A:L").Select
Selection.Cut
Sheets.Add
ActiveSheet.Paste
End Sub
|