06-10-2022, 07:42 PM
OK everything aligns:
Code: (Select All)
Option _Explicit
Dim As Double ProductMaterial, IndirectCost, MaterialCost
ProductMaterial = getNumber(10, 23, "Production material")
'Input "Production material : ",
IndirectCost = (ProductMaterial * 8) / 100
PU 11, 23, "Indirect material cost", IndirectCost
MaterialCost = ProductMaterial + IndirectCost
PU 12, 23, "Material costs", MaterialCost
Sub PU (row, col, label$, number As Double) ' label needs to be 25 chars max
Dim buf$
Locate row, col
buf$ = Space$(25)
Mid$(buf$, 1) = label$
Print Using buf$ + ": ###,###.##"; number
End Sub
Function getNumber# (row, col, prompt25$) ' might need to control length of output
Dim K$, num$
Locate row, col: Print prompt25$; "? "
K$ = InKey$
While K$ <> Chr$(13)
If Len(K$) Then
If InStr("-123456789.", K$) Then
num$ = num$ + K$
PU row, col, prompt25$, Val(num$)
ElseIf Asc(K$) = 8 Then
If Len(num$) Then
num$ = Left$(num$, Len(num$) - 1)
PU row, col, prompt25$, Val(num$)
End If
End If
End If
K$ = InKey$
Wend
getNumber# = Val(num$)
End Function
b = b + ...