Phelony
05-14-2009, 05:01 AM
Hi guys :hi:
Hope you're all doing well. Once more I'm here to lay a minor annoying problem out and hope you can :help with what is most likely another silly bit of programming from me!
This little snippet of code is supposed to find the word yes in column G, cut the row and then paste it sequentially on another sheet.
It fails on the pasting part and I really can't figure out why. :bug:
NB - this works if you put copy where it says cut, but I really do need to cut and paste.
' DatamoveR Macro
'
Dim r As Long, lastrow As Long, rOut As Long
rOut = 1
lastrow = Sheets("Sheet1").range("G65536").End(xlUp).Row
For r = 1 To lastrow
If Sheets("sheet1").Cells(r, 7) Like "yes" Then
Sheets("sheet1").Rows(r).EntireRow.Cut
Sheets("sheet2").Rows(rOut).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
rOut = rOut + 1
End If
Next r
Application.CutCopyMode = False
End Sub
Thoughts gentlemen?
Thanks
Phel x
Hope you're all doing well. Once more I'm here to lay a minor annoying problem out and hope you can :help with what is most likely another silly bit of programming from me!
This little snippet of code is supposed to find the word yes in column G, cut the row and then paste it sequentially on another sheet.
It fails on the pasting part and I really can't figure out why. :bug:
NB - this works if you put copy where it says cut, but I really do need to cut and paste.
' DatamoveR Macro
'
Dim r As Long, lastrow As Long, rOut As Long
rOut = 1
lastrow = Sheets("Sheet1").range("G65536").End(xlUp).Row
For r = 1 To lastrow
If Sheets("sheet1").Cells(r, 7) Like "yes" Then
Sheets("sheet1").Rows(r).EntireRow.Cut
Sheets("sheet2").Rows(rOut).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
rOut = rOut + 1
End If
Next r
Application.CutCopyMode = False
End Sub
Thoughts gentlemen?
Thanks
Phel x