Private Sub HarvestSave_Click()
'Checks to make sure all Textboxes have values entered first
If HarvestStartTime.Text = "" Then
MsgBox "Please enter a Harvest Start Time, When Mills Removed From Incubator"
Exit Sub
End If
If HarvestAdjStartTime.Text = "" Then
MsgBox "Please enter a Harvest Adjuvant Addition Start Time"
Exit Sub
End If
If HarvestAdjEndTime.Text = "" Then
MsgBox "Please enter a Harvest Adjuvant Addition End Time"
Exit Sub
End If
If HarvRemBeforeAsp.Text = "" Then
MsgBox "Please enter a Mills Removed Before Aspiration Value"
Exit Sub
End If
If NumberMillsHarvest.Text = "" Then
MsgBox "Please enter a Mills Harvested Value"
Exit Sub
End If
If NumberMathRemove.Text = "" Then
MsgBox "Please enter a Mills Removed After Math Value"
Exit Sub
End If
If NumberMillsUsed.Text = "" Then
MsgBox "Please enter a Number of Mills used for Process Value"
Exit Sub
End If
If LostRecal.Text = "" Then
MsgBox "Please enter a How Many Mills Removed due to Recalculation Value"
Exit Sub
End If
If AvgWetWt.Text = "" Then
MsgBox "Please enter a Average Wet Weight Value"
Exit Sub
End If
If HarvestYield.Text = "" Then
MsgBox "Please enter a Harvest Yield Value"
Exit Sub
End If
Dim Batch_Number As String
Batch_Number = Trim(HarvestBatchSearch.Text)
lastrow = Worksheets("Per Batch Data").Cells(Rows.Count, 2).End(xlUp).Row
UnProtectSheet 'runs macro to un-protect sheet before entering information
'Asks if user is sure they want to save.
If MsgBox("Do you want to save the data?", vbYesNo + vbQuestion, "question") = vbNo Then
Exit Sub
End If
'Will not save over start and end dates or Incubator IDs if someone tries to edit them
For I = 2 To lastrow
If Worksheets("Per Batch Data").Cells(I, 2).Text = Batch_Number Then
Worksheets("Per Batch Data").Cells(I, 64).Text = HarvestStartTime.Text
Worksheets("Per Batch Data").Cells(I, 70).Text = HarvestAdjStartTime.Text
Worksheets("Per Batch Data").Cells(I, 71).Text = HarvestAdjEndTime.Text
Worksheets("Per Batch Data").Cells(I, 72).Value = HarvRemBeforeAsp.Value
Worksheets("Per Batch Data").Cells(I, 73).Value = NumberMillsHarvest.Value
Worksheets("Per Batch Data").Cells(I, 74).Value = NumberMathRemove.Value
Worksheets("Per Batch Data").Cells(I, 75).Value = NumberMillsUsed.Value
Worksheets("Per Batch Data").Cells(I, 78).Value = LostRecal.Value
Worksheets("Per Batch Data").Cells(I, 76).Value = AvgWetWt.Value
Worksheets("Per Batch Data").Cells(I, 80).Value = HarvestYield.Value
Worksheets("Per Batch Data").Cells(I, 202).Text = HarvNotes.Text
End If
Next
'reprotects the sheet after answering form and clears out form for next batch
ReProtectSheet
'blanks textboxes to reset form for next entry
Initiatize_Inputs
End Sub