So here is my code, can anyone tell me why I'm getting an x400 error?
The code is supposed to take from the sheet "Input" and copy the selection into "Sheet1" if it is "Product1" in cell B21-b120.
Application.ScreenUpdating = False
Dim i As Long
Dim sheet1count As Integer
i = 21
sheet1count = 0
Do While i <= 120
Worksheets("Input").Activate
Range("B" & i).Select
If Range("B" & i) = "Product1" Then
Range(("B" & i), ("z" & i)).Select
Application.CutCopyMode = False
Selection.Copy
Worksheets("Sheet1").Activate
Range("A" & (3 + sheet1count)).Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
sheet1count = sheet1count + 1
End If
SkipLine:
i = i + 1
Loop
Application.ScreenUpdating = True
Worksheets("Sheet1").Activate
MsgBox ("Done!")
End Sub
The code is supposed to take from the sheet "Input" and copy the selection into "Sheet1" if it is "Product1" in cell B21-b120.
Application.ScreenUpdating = False
Dim i As Long
Dim sheet1count As Integer
i = 21
sheet1count = 0
Do While i <= 120
Worksheets("Input").Activate
Range("B" & i).Select
If Range("B" & i) = "Product1" Then
Range(("B" & i), ("z" & i)).Select
Application.CutCopyMode = False
Selection.Copy
Worksheets("Sheet1").Activate
Range("A" & (3 + sheet1count)).Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
sheet1count = sheet1count + 1
End If
SkipLine:
i = i + 1
Loop
Application.ScreenUpdating = True
Worksheets("Sheet1").Activate
MsgBox ("Done!")
End Sub