For example, there is a listbox to select the Sample Type if it needs to be changed in the spreadsheet with existing data. I have no code for the listbox, but have made some changes in the properties to identify the source of the list and leave as a single selection.
There is a command button with code behind it to send all the listbox and textbox values that the user entered to the active sheet.
Private Sub cmdSendPIDdata_Click()
Cells.AutoFilter
'Advance to last row
Range("B1").End(xlDown).Offset(1, 0).Select
'Constants and user data
Range("B" & (ActiveCell.Row)).Value = "'" & SamplePointID
Range("J" & (ActiveCell.Row)).Value = "'PID MEASUREMENT"
Range("N" & (ActiveCell.Row)).Value = "'PPB"
Range("F" & (ActiveCell.Row)).Value = "'" & dtpSampleDate.Value
Range("G" & (ActiveCell.Row)).Value = "'" & txtTime.Value
Range("H" & (ActiveCell.Row)).Value = "'" & lbxSampleType.Value
Range("K" & (ActiveCell.Row)).Value = "'" & txtConcentration.Value
Range("AK" & (ActiveCell.Row)).Value = "'" & lbxSampleLocation.Value
Range("AN" & (ActiveCell.Row)).Value = "'" & lbxSampledBy.Value
Unload Me
frmPIDDataEntry.Show
End Sub
If nothing is selected in the list box, it's clearing the existing value in the corresponding range.