ahmadzharif89
New Member
- Joined
- Sep 14, 2015
- Messages
- 2
Hello everyone!
I am trying to create a button which cuts cells Bx to Fx if the cell Fx contains the word "outlier" and paste it to a different part of excel sheet. My code seems to work up to the "Cut" part but stops at the paste. It has an error on "ActiveSheet.Paste" part of the code. Please help. Here is what I have so far:
Sub Button_Click()
'Generate Outliers
Dim j, k
For j = 5 To 1050
If Cells(j, "F").Value = "OUTLIER" Then
Range(Cells(j, "B"), Cells(j, "F")).Select
Selection.Cut
End If
For k = 5 To 19
ActiveSheet.Range(Cells(k, "B"), Cells(k, "F")).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Next k
Next j
End Sub
Also, If it is possible I would actually like to paste it to a different worksheet.
THANK YOU!
I am trying to create a button which cuts cells Bx to Fx if the cell Fx contains the word "outlier" and paste it to a different part of excel sheet. My code seems to work up to the "Cut" part but stops at the paste. It has an error on "ActiveSheet.Paste" part of the code. Please help. Here is what I have so far:
Sub Button_Click()
'Generate Outliers
Dim j, k
For j = 5 To 1050
If Cells(j, "F").Value = "OUTLIER" Then
Range(Cells(j, "B"), Cells(j, "F")).Select
Selection.Cut
End If
For k = 5 To 19
ActiveSheet.Range(Cells(k, "B"), Cells(k, "F")).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Next k
Next j
End Sub
Also, If it is possible I would actually like to paste it to a different worksheet.
THANK YOU!