Here's the code:
Sub editRecord()
Load UserForm1
UserForm1.tbEditNew = "Edit"
UserForm1.txtDate = ActiveCell.Value
Select Case ActiveCell.Offset(0, 3).Value
Case "Cedar Hill"
UserForm1.selectCedarHill = True
UserForm1.selectDeSoto = False
UserForm1.selectLancaster = False
Case "DeSoto"
UserForm1.selectCedarHill = False
UserForm1.selectDeSoto = True
UserForm1.selectLancaster = False
Case "Lancaster"
UserForm1.selectCedarHill = False
UserForm1.selectDeSoto = False
UserForm1.selectLancaster = True
End Select
Select Case ActiveCell.Offset(0, 8)
Case "AM only"
UserForm1.obAMonly = True
UserForm1.obAMPM = False
UserForm1.obPMonly = False
Case "AM / PM"
UserForm1.obAMonly = False
UserForm1.obAMPM = True
UserForm1.obPMonly = False
Case "PM only"
UserForm1.obAMonly = False
UserForm1.obAMPM = False
UserForm1.obPMonly = True
End Select
UserForm1.lbSelectDriver.Value = ActiveCell.Offset(0, 2)
driverID = ActiveCell.Offset(0, 1)
If ActiveCell.Offset(0, 9) <> "" Then
UserForm1.lbReasons.Value = ActiveCell.Offset(0, 9)
End If
If ActiveCell.Offset(0, 10) <> "" Then
UserForm1.lbSelectStandbyAM.Value = ActiveCell.Offset(0, 10)
End If
If ActiveCell.Offset(0, 11) <> "" Then
UserForm1.lbSelectStandbyMD.Value = ActiveCell.Offset(0, 11)
End If
If ActiveCell.Offset(0, 12) <> "" Then
UserForm1.lbSelectStandbyPM.Value = ActiveCell.Offset(0, 12)
End If
If ActiveCell.Offset(0, 13) <> "" Then
UserForm1.lbSelectStandbyOther.Value = ActiveCell.Offset(0, 13)
End If
UserForm1.Show
End Sub
I'm pulling a "record" from the worksheet, putting the data into the userForm and allowing the user to further edit the data.
Bob
Bookmarks