Amateurhour101
New Member
- Joined
- May 8, 2020
- Messages
- 3
- Office Version
- 2011
- Platform
- MacOS
Hi all, I am trying to copy Columns A to D where the Column 5 ("E") is Inventory, to another tab -> aptly called Inventory. Excel keeps having trouble with the yellow line in the script below. I would appreciate any help to this issue.
Many thanks
Dave
Sub Inventory_Loop()
Dim irow As Long
A = Worksheets("DATA").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To A
If Worksheets("DATA").Cells(i, 5).Value = "INVENTORY" Then
Worksheets("DATA").Range(Cells(irow, "A"), Cells(irow, "D")).Copy
Worksheets("Inventory").Activate
Worksheets("Inventory").Cells(1,3).Select
ActiveSheet.Paste
Worksheets("DATA").Activate
End If
Next
Application.CutCopyMode = False
ThisWorkbook.Worksheets("DATA").Cells(1, 1).Select
End Sub
Many thanks
Dave
Sub Inventory_Loop()
Dim irow As Long
A = Worksheets("DATA").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To A
If Worksheets("DATA").Cells(i, 5).Value = "INVENTORY" Then
Worksheets("DATA").Range(Cells(irow, "A"), Cells(irow, "D")).Copy
Worksheets("Inventory").Activate
Worksheets("Inventory").Cells(1,3).Select
ActiveSheet.Paste
Worksheets("DATA").Activate
End If
Next
Application.CutCopyMode = False
ThisWorkbook.Worksheets("DATA").Cells(1, 1).Select
End Sub