This my first attempt writing code in Excel. I am stupmed on why when i press run sub while under forms the following code works but when i load it into Modules and run it I get "run-time error 424 object required"?
I get the error on the bold text.
Sub PartListForm()
UserForm.Show
End Sub
Private Sub cmdOK_Click()
ActiveWorkbook.Sheets("Part_List").Activate
Range("a3").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = txtPartNumber.Value
ActiveCell.Offset(0, 1) = txtCustomer.Value
ActiveCell.Offset(0, 2) = txtCustomerItemNumber.Value
ActiveCell.Offset(0, 3) = txtothercustitem.Value
ActiveCell.Offset(0, 4) = txtFilmType.Value
ActiveCell.Offset(0, 5) = txtFilmSize.Value
ActiveCell.Offset(0, 6) = txtFinishedRollSize.Value
ActiveCell.Offset(0, 7) = txtSleeveSize.Value
ActiveCell.Offset(0, 8) = txtMachineType.Value
Range("A3").Select
End Sub
Private Sub PartListForm_Initialize()
txtPartNumber.Value = ""
txtCustomer.Value = ""
txtCustomerItemNumber.Value = ""
txtothercustitem.Value = ""
txtFilmType.Value = ""
txtFilmSize.Value = ""
txtFinishedRollSize.Value = ""
txtSleeveSize.Value = ""
txtMachineType.Value = ""
txtPartNumber.SetFocus
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdReset_Click()
Call UserForm_Initialize
End Sub
Thanks
I get the error on the bold text.
Sub PartListForm()
UserForm.Show
End Sub
Private Sub cmdOK_Click()
ActiveWorkbook.Sheets("Part_List").Activate
Range("a3").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = txtPartNumber.Value
ActiveCell.Offset(0, 1) = txtCustomer.Value
ActiveCell.Offset(0, 2) = txtCustomerItemNumber.Value
ActiveCell.Offset(0, 3) = txtothercustitem.Value
ActiveCell.Offset(0, 4) = txtFilmType.Value
ActiveCell.Offset(0, 5) = txtFilmSize.Value
ActiveCell.Offset(0, 6) = txtFinishedRollSize.Value
ActiveCell.Offset(0, 7) = txtSleeveSize.Value
ActiveCell.Offset(0, 8) = txtMachineType.Value
Range("A3").Select
End Sub
Private Sub PartListForm_Initialize()
txtPartNumber.Value = ""
txtCustomer.Value = ""
txtCustomerItemNumber.Value = ""
txtothercustitem.Value = ""
txtFilmType.Value = ""
txtFilmSize.Value = ""
txtFinishedRollSize.Value = ""
txtSleeveSize.Value = ""
txtMachineType.Value = ""
txtPartNumber.SetFocus
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdReset_Click()
Call UserForm_Initialize
End Sub
Thanks