I am trying to connect to workbooks to track orders. One workbook(Book1) displays the order#, total qty and current qty(completed so far) alongside a list of the weeks orders in the production office. The other workbook(Book2) is at the workstation for the operator to enter the new order number and current quantity as parts are completed.
The first half of the code works fine. It successfully updates the order# and pastes it to Book1 from Book2. What I am having trouble accomplishing is updating the cell in the "status" column of the table with the corresponding order# that was just pasted into the workbook to either a 1 or 2. I have the table formatted to where a blank cell is red(order not active), 1 = yellow(order is open) and 2 = green(order complete).
I tried the code below using an "IF" off of the Order Count being 0 because it will reset before the pasting of the new Order#. NOTE: orders may not be completed in the order they are listed so it has to be some type of lookup. I can't just find the last empty cell in the "status" column.
Update* FIGURED IT OUT! Code below now works in case anyone elses comes across this thread!
Thank you to everyone in the comments below.
Private Sub CommandButton1_Click()
Dim wbEntry As Workbook
Set wbEntry = ThisWorkbook
Dim wbCount As Workbook
Set wbCount = Workbooks("MO# Count.xlsm")
wbEntry.Sheets("Sheet1").Range("B3").Copy
wbCount.Activate
wbCount.Worksheets("Golf Cart").Range("V5").Select
ActiveCell.PasteSpecial xlPasteValues
Dim Fnd As Range
Set Fnd = Sheets("Golf Cart").Range("A:A").Find(Sheets("Golf Cart").Range("V5").Value, , , xlWhole, , , False, , False)
If Not Fnd Is Nothing Then
Set Fnd = Fnd.Offset(0, 2)
End If
Fnd.Value = 1
ActiveWorkbook.Save
wbEntry.Activate
Application.CutCopyMode = False
wbEntry.ActiveSheet.Range("H2").Select
End Sub