skeeeter56
New Member
- Joined
- Nov 26, 2016
- Messages
- 42
- Office Version
- 2019
- Platform
- Windows
Hi I have a file that is use to record daily data, it is entered by a form.
The code below runs when you hit OK on the form, its all works well.
Occasionally the value
is left empty as the name is not in the data validation list that is use on form to select.
When this occurs I would like to just simply have a value "Outside Relief" added.
I am thinking it may be done in the code before the row is added if the
is empty
,
If someone is able to assist me I would be most grateful
The code below runs when you hit OK on the form, its all works well.
Occasionally the value
VBA Code:
cboEmployee.Value
When this occurs I would like to just simply have a value "Outside Relief" added.
I am thinking it may be done in the code before the row is added if the
VBA Code:
cboEmployee.Value
VBA Code:
Private Sub bOkay2_Click()
Dim tbl As ListObject
Dim ws As Worksheet
Dim lrow As Range
Dim lrow2 As Long
Set tbl = Sheets("Missed Scan Summary").ListObjects("tblncidents")
If tbl.ListRows.Count > 0 Then
Set lrow = tbl.ListRows(tbl.ListRows.Count).Range
For col = 1 To lrow.Columns.Count
If Trim(CStr(lrow.Cells(1, col).Value)) <> "" Then
tbl.ListRows.Add
Exit For
End If
Next
End If
lrow2 = tbl.ListRows.Count
tbl.DataBodyRange(lrow2, 1).Value = CDate(txtDate.Value)
tbl.DataBodyRange(lrow2, 2).Value = cboRound.Value
tbl.DataBodyRange(lrow2, 3).Value = cboEmployee.Value
tbl.DataBodyRange(lrow2, 4).Value = cboType.Value
tbl.DataBodyRange(lrow2, 5).Value = txtArticleNo.Value
tbl.DataBodyRange(lrow2, 6).Value = cboReason.Value
tbl.DataBodyRange(lrow2, 7).Value = cboTeamLeader.Value
Unload Me
End Sub
If someone is able to assist me I would be most grateful