A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
In Module1 edit the code as per the comments in bold italics in the example code below. (Delete the old line and insert the new line it its place).
Because you have placed an alpha on the end of the number it does not evaluate to a numeric to identify that it is not the column header so we will test the left 5 characters only to ensure they are numeric.
You will need to re-insert your column header (Total Boards Required) in cell E1.
Function TotUnits(rng As Range) As Long
Dim ws As Worksheet
Dim rngTemp As Range
Application.Volatile
Set ws = rng.Parent
With ws
Set rngTemp = .Cells(rng.Row, 1) 'Assign range variable to the cell same row in Part# column
If rngTemp.Value = "" Then 'If the cell in column A and on same row is blank
Set rngTemp = rngTemp.End(xlUp) 'Move up to non blank cell containing the Part# and assign that cell to the range variable
End If
'If IsNumeric(rngTemp) Then 'Delete this line of code
If IsNumeric(Left(rngTemp, 5)) Then 'Replace deleted line with this line of code
'If first Part# is deleted then rngTemp becomes the column header and will not be numeric and cause an error.
TotUnits = rngTemp.Offset(0, 1).Value 'Assign the value in the Cell to right of Part# (#Full Units Required) to the Funtion
Else
TotUnits = 0 'Set to zero if first Part# is deleted
End If
End With
End Function