Pahickham
New member
- Joined
- Jun 5, 2017
- Messages
- 25
- Reaction score
- 0
- Points
- 0
- Excel Version(s)
- 2013
I have this code that is meant to either copy and paste from Inventory list to Low list, given a certain condition, or cut/paste/delete empty row from inventory list to out of service list. The copy and paste part works, but the cut section isn't pasting to the out of service list. Initially this wasn't an event type and worked fine, but then I tried converting it to an event type and now that section wont't work. I've had to rig a few things, so any help's appreciated.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)Dim i, LastRow
LastRow = Sheets("Inventory").Range("A" & Rows.Count).End(xlUp).row
Sheets("Out of Service").Range("A2:I500").ClearContents
Sheets("Low").Range("A2:I500").ClearContents
For i = 2 To LastRow
If Sheets("Inventory").Cells(i, "E").Value = "0" Then
Sheets("Inventory").Cells(i, "H").EntireRow.Cut Destination:=Sheets("Out of Service").Range("A" & Rows.Count).End(xlUp).Offset(1)
Sheets("Inventory").Range("H:H").SpecialCells(xlBlanks).EntireRow.Delete
End If
If Sheets("Inventory").Cells(i, "D").Value < Cells(i, "E") Then
Sheets("Inventory").Cells(i, "H").EntireRow.Copy Destination:=Sheets("Low").Range("A" & Rows.Count).End(xlUp).Offset(1)
End If
Next i
End Sub