I have this VBA code that converts the quantity of an item from how many inches to how many rolls
this code is not working on a particular file, see below, there are 276 inches of this item
using this equation: ((n / 12) \ 14.5) * 2, and the returned result is 0 ?
Test file below
code below
any help, or criticism on the way this code is written is welcomed.. thanks !
this code is not working on a particular file, see below, there are 276 inches of this item
using this equation: ((n / 12) \ 14.5) * 2, and the returned result is 0 ?
Test file below
code below
VBA Code:
Sub SealantConseal()
Dim lrNew As Long
lrNew = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
sr = 2
With Range("M1", Cells(Rows.Count, "M").End(3))
.Replace What:="""", Replacement:=vbNullString, LookAt:=xlPart 'REMOVE THE INCH MARK
.Replace What:="/JOINT", Replacement:=vbNullString, LookAt:=xlPart ' REMOVE /JOINT
End With
n = WorksheetFunction.SumIfs(Range("M" & sr & ":M" & lr), Range("K" & sr & ":K" & lr), "*JOINT SEALANT*")
lrNew = lrNew + 1
Cells(lrNew, "A") = Cells(lr, "A")
Cells(lrNew, "B") = "."
Cells(lrNew, "C") = ((n / 12) \ 14.5) * 2 ' \ REMOVED ALL NUMBERS AFTER DECIMAL
Cells(lrNew, "D") = "F51019"
Cells(lrNew, "I") = "Purchased"
Cells(lrNew, "K") = "CS-102 Sealant"
If Cells(lrNew, "C").Value = 0 Then
Rows(lrNew).Delete
End If
End Sub
any help, or criticism on the way this code is written is welcomed.. thanks !