I get an error 1004 on a line but with the exact same line of code above it, I don't...
What am I doing wrong?
Do While ThisWorkbook.Sheets("Part_List").Cells(rowPartList, 1) <> "End" << No Error here
If (ThisWorkbook.Sheets("Part_List").Cells(rowPartList, 3) = "") Or (ThisWorkbook.Sheets("Part_List").Cells(rowPartList, 3) = "Part number") Then
Rows(rowPartList).EntireRow.Delete
rowPartList = rowPartList - 1
End If
rowPartList = rowPartList + 1
If ThisWorkbook.Sheets("Part_List").Cells(rowPartList - 1, 1) = "End" Then
Exit Do
End If
Loop
wb1.Close
Set wb2 = Workbooks("CHP Facility Inventory.xls")
rowPartList = 4
Do While ThisWorkbook.Sheets("Part_List").Cells(rowPartList, 1) <> "End" << BUT Error Here
rowInventory = 3
Do Until (wb2.Sheets("Inventory List").Cells(rowInventory, 1) = "") And (wb2.Sheets("Inventory List").Cells(rowInventory, 4) = "") And (wb2.Sheets("Inventory List").Cells(rowInventory, 5) = "")
If wb2.Sheets("Inventory List").Cells(rowInventory, 1) <> "" Then
If ThisWorkbook.Sheets("Part_List").Cells(rowPartList, 1) = wb2.Sheets("Inventory List").Cells(rowInventory, 1) Then
ThisWorkbook.Sheets("Part_List").Cells(rowPartList, 1).Interior.ColorIndex = 4
End If
End If
rowInventory = rowInventory + 1
Loop
rowPartList = rowPartList = 1
Loop
What am I doing wrong?
Do While ThisWorkbook.Sheets("Part_List").Cells(rowPartList, 1) <> "End" << No Error here
If (ThisWorkbook.Sheets("Part_List").Cells(rowPartList, 3) = "") Or (ThisWorkbook.Sheets("Part_List").Cells(rowPartList, 3) = "Part number") Then
Rows(rowPartList).EntireRow.Delete
rowPartList = rowPartList - 1
End If
rowPartList = rowPartList + 1
If ThisWorkbook.Sheets("Part_List").Cells(rowPartList - 1, 1) = "End" Then
Exit Do
End If
Loop
wb1.Close
Set wb2 = Workbooks("CHP Facility Inventory.xls")
rowPartList = 4
Do While ThisWorkbook.Sheets("Part_List").Cells(rowPartList, 1) <> "End" << BUT Error Here
rowInventory = 3
Do Until (wb2.Sheets("Inventory List").Cells(rowInventory, 1) = "") And (wb2.Sheets("Inventory List").Cells(rowInventory, 4) = "") And (wb2.Sheets("Inventory List").Cells(rowInventory, 5) = "")
If wb2.Sheets("Inventory List").Cells(rowInventory, 1) <> "" Then
If ThisWorkbook.Sheets("Part_List").Cells(rowPartList, 1) = wb2.Sheets("Inventory List").Cells(rowInventory, 1) Then
ThisWorkbook.Sheets("Part_List").Cells(rowPartList, 1).Interior.ColorIndex = 4
End If
End If
rowInventory = rowInventory + 1
Loop
rowPartList = rowPartList = 1
Loop