Sub BoxCount()
' Send copy to History Sheet
Dim c As Long
Dim HistWks As Worksheet
Dim LastEntry As Range
Dim Rng As Range
Dim SizeWks As Worksheet
Dim Wks As Worksheet
Set Wks = Sheet1
Set HistWks = Worksheets("History Sheet")
Set Rng = HistWks.Range("A3:C3")
c = Rng.Columns.Count
Set LastEntry = HistWks.Cells(Rows.Count, "A").End(xlUp)
If LastEntry.Row >= 3 Then Set Rng = LastEntry.Offset(1, 0)
With ActiveCell
Rng.Resize(1, c).Value = Wks.Cells(.Row, "B").Resize(1, c).Value
On Error Resume Next
Set SizeWks = Worksheets(Wks.Cells(.Row, "B").Value)
If Err <> 0 Then
MsgBox "Please Select a Row."
Exit Sub
End If
On Error GoTo 0
End With
Dim Qty1 As Double
Qty1 = ThisWorkbook.Worksheets(1).Range("C18").Value - _
ThisWorkbook.Worksheets(1).Range("B18").Value
ThisWorkbook.Worksheets(1).Range("C18").Value = Qty1
' Highlight cell Red if the value is less than order quantity
If ThisWorkbook.Worksheets(1).Range("C18").Value <= 1500 Then
ThisWorkbook.Worksheets(1).Range("C18").Interior.Color = RGB(250, 0, 0)
End If
'Clear cell after subtraction
ThisWorkbook.Worksheets(1).Range("B18").Value = ""
'Message Box too order boxes when below 1500
If ThisWorkbook.Worksheets(1).Range("C18").Value <= 1500 Then
MsgBox ("Tell Chris to order more boxes")
End If
End Sub
I have been working on another way to send it to the "History Sheet" similar to the way it was sent with the other Active x buttons but it keeps giving me an error and tripping out the please select a row message.
When I am selected in any of the three boxes it will send the copy to the history sheet, but when I am selected somewhere else on the sheet it will not send a copy to the history sheet.
Either way the new code keeps stopping on the bolded area.
Bookmarks