My apologies for not including my code, it is below.
I am cutting a range of cells in a row that has been marked with an “x
in column A and pasting the values to sheet4. The cells I am cuttin
has formulas and fills which I do not what to copy over hence the us
of PasteSpecial. The code works fine with copy but not cut.
I receive the error: “PasteSpecial method of range class failed” at th
line that I notated in the code.
Thanks for the help.
Ron
Sub cutpaste()
Dim LastRow1 As Integer
Dim LastRow2 As Integer
Dim x As Integer
Dim w As Integer
‘loop though sheets
For w = 1 To Worksheets.Count - 1
Sheets(w).Select
LastRow2 = Sheets("sheet4").UsedRange.Rows.Count + 1
LastRow1 = ActiveSheet.UsedRange.Rows.Count
'loop though rows
For x = 2 To LastRow1 'set x value to first row of data
Cells(x, 1).Select
If ActiveCell.Value = "x" Or ActiveCell.Value = "X" Then
Range(Cells(x, 2), Cells(x, 4)).Select
Selection.Cut ‘***if I substitute Paste for cut it run
ok
Sheets("Sheet4").Select
Range(Cells(LastRow2, 3), Cells(LastRow2, 5)).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=Fals
‘****This is where I get the error
Application.CutCopyMode = False
Range(Cells(LastRow2, 1), Cells(LastRow2, 5)).Select
Selection.Font.Bold = True
Cells(LastRow2, 1) = Cells((LastRow2 - 1), 1).Value + 1
Cells(LastRow2, 2) = Sheets(w).Name
Range("A1").Select
Sheets(w).Select
Range("A1").Select
LastRow2 = LastRow2 + 1
End If
Next x
Next w
Sheets("Sheet4").Select
Range("A1").Select
End Su