On a UserForm, I have Frame1 which contains Option Buttons (opt_SalesLine & opt_TechLine) which are used to determine to which worksheet the data will be sent.
Here's the EnterButton VBA code I have to this point...
Code
Private Sub EnterButton_Click() Dim NextRow As Long
' Make Sales or Tech worksheet active
If opt_SalesLine Then Sheets("SalesCalls").Activate
If opt_TechLine Then Sheets("TechCalls").Activate
' Determine the next empty row
NextRow = Application.WorksheetFunction. _
CountA(Range("A:A")) + 1
' Insert date and time in first cell of worksheet
Cells(NextRow, 1) = (Now)
' Transfer data from form to worksheet
Cells(NextRow, 2) = txt_TechName.Text
Cells(NextRow, 3) = txt_ServiceTicket
Cells(NextRow, 4) = txt_CustomerName
Cells(NextRow, 5) = txt_CustomerPhone
Cells(NextRow, 6) = txt_Issue
If opt_Sale Then Cells(NextRow, 7) = "Sale"
If opt_NoSale Then Cells(NextRow, 7) = "Fail"
' Clear the controls for the next entry
opt_SalesLine = True
txt_TechName.Text = ""
txt_ServiceTicket.Text = ""
txt_CustomerName.Text = ""
txt_CustomerPhone.Text = ""
txt_Issue.Text = ""
' opt_Sale = True
txt_TechName.SetFocus
' Populate Close Rate textbox
txt_CloseRate.Value = Worksheets("Dashboard").Range("I2").Value
' Save workbook to prevent data loss
ActiveWorkbook.Save
End Sub
Display More
I don't want to make either option default, but I need to make it mandatory that one of these options is selected before the UserForm data can be sent to the appropriate worksheet. Just started with VBA on this side-project, so please, use newbie language