I have a form that takes a user input and multiplies that input by values in another worksheet using a Text Box. I want all the inputs to take place in the same form but for some reason it's printing out 0 for my calculations. Should I use another control for a numerical input?
Global qty1 As Variant
Global qty2 As Variant
'assign qty1 and qty2 as input variables for number of assemblies
Sub PartOrder()
Sheets.Add After:=Worksheets(Sheets.Count) 'Creates new worksheet for part order form
PartOrderForm.Show 'displays the form
End Sub
Private Sub CompleteForm_Click()
If CheckBox1.Value = True Then 'If the first assembly is selected
ActiveSheet.Range("A1") = "Part Number"
ActiveSheet.Range("B1") = "Part Name"
ActiveSheet.Range("C1") = "Number of Parts Needed" 'Column headings
TextBox2.Value = qty1 'quantity of 1st assembly
Range("A2").Activate
For i = 3 To 8 'For loop copies part numbers, names and number of parts needed into new sheet
ActiveSheet.Cells(i - 1, 1) = Worksheets("F8X SUSPENSION LINKS REV2").Cells(4 + i, 2)
ActiveSheet.Cells(i - 1, 2) = Worksheets("F8X SUSPENSION LINKS REV2").Cells(4 + i, 3)
ActiveSheet.Cells(i - 1, 3) = Worksheets("F8X SUSPENSION LINKS REV2").Cells(4 + i, 6) * qty1
Next i
Else: End If
If CheckBox2.Value = True Then 'Repeat code above if Trail link is selected
TextBox3.Value = qty2
For i = 3 To 8
ActiveSheet.Cells(i + 6, 1) = Worksheets("F8X SUSPENSION LINKS REV2").Cells(13 + i, 2)
ActiveSheet.Cells(i + 6, 2) = Worksheets("F8X SUSPENSION LINKS REV2").Cells(13 + i, 3)
ActiveSheet.Cells(i + 6, 3) = Worksheets("F8X SUSPENSION LINKS REV2").Cells(13 + i, 6) * qty2
Next i
Else: End If
ActiveSheet.Range("A1:C1").Columns.AutoFit 'Formatting cells
End Sub