View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone[_2_] Jim Cone[_2_] is offline
external usenet poster
 
Posts: 1,549
Default Paste failing after cut

Swap these two lines...
Application.CutCopyMode = False
ActiveSheet.Paste

--
Jim Cone
Portland, Oregon USA
http://www.mediafire.com/PrimitiveSoftware
(Permutations Add-in: option to highlight valid words)





"stainless"
wrote in message
...
I have a "Grouped by" worksheet that has autofilter on. Row J has 2
possible values, "Wants" and Purchased".

I want to cut the rows with "Wants" in this column and paste these at
the end of the worksheet rows. Unfortunately, the actual Paste
statement is failing, with no real help as to why. My cut and paste
function is below:

Sub MoveWants()

Dim PurchasedWantsColumnNumber As Integer

With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

gLogText = RTrim(gSheetName) + ": Moving Wants rows in " +
ActiveSheet.Name
WriteLog (gLogText)

PurchasedWantsColumnNumber =
ConvertColumnLetterToNumber(gPurchasedWantsColumn)

Application.CutCopyMode = xlCut
Selection.AutoFilter Field:=PurchasedWantsColumnNumber,
Criteria1:="Wants"
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Cut
Selection.AutoFilter Field:=PurchasedWantsColumnNumber
Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(2, 0).Select

Application.CutCopyMode = False
ActiveSheet.Paste

With Application
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With

End Sub

I have experimented with the Application.CutCopyMode and also used the
following statement instead of ActiveSheet.Paste:

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

The cut seems to work (viewed this in the worksheet) but the Paste
statement always fails.

Any ideas please?