Greetings all,
I have the following code:
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
I have three inputs Agent name, QA score, and Date. How would I change the above code to automatically enter the QA score and Date data under each Agents name/column instead of the first free space on the sheet
My spreadsheet is set up similar to the following.
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Agent one[/TD]
[TD][/TD]
[TD]Agent 2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]XX.XX%[/TD]
[TD]Average[/TD]
[TD]XX.XX%[/TD]
[TD]Average[/TD]
[/TR]
[TR]
[TD]Score[/TD]
[TD]Date[/TD]
[TD]Score[/TD]
[TD]Date[/TD]
[/TR]
[TR]
[TD]95%[/TD]
[TD]11/21[/TD]
[TD]100%[/TD]
[TD]11/20[/TD]
[/TR]
</tbody>[/TABLE]
My entire code for the submission button is following:
Private Sub CommandButton1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("QA Form")
'find
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
'check for a agent name
If Trim(Me.AGT.Value) = "" Then
Me.AGT.SetFocus
MsgBox "Missing Agent name"
Exit Sub
End If
With ws
.Cells(iRow, 1).Value = Me.AGT.Value
.Cells(iRow, 2).Value = Me.SCR.Value
.Cells(iRow, 3).Value = Me.DTE.Value
End With
'clear the data
Me.AGT.Value = ""
Me.SCR.Value = ""
Me.DTE.Value = ""
Me.AGT.SetFocus
End Sub
I have the following code:
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
I have three inputs Agent name, QA score, and Date. How would I change the above code to automatically enter the QA score and Date data under each Agents name/column instead of the first free space on the sheet
My spreadsheet is set up similar to the following.
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Agent one[/TD]
[TD][/TD]
[TD]Agent 2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]XX.XX%[/TD]
[TD]Average[/TD]
[TD]XX.XX%[/TD]
[TD]Average[/TD]
[/TR]
[TR]
[TD]Score[/TD]
[TD]Date[/TD]
[TD]Score[/TD]
[TD]Date[/TD]
[/TR]
[TR]
[TD]95%[/TD]
[TD]11/21[/TD]
[TD]100%[/TD]
[TD]11/20[/TD]
[/TR]
</tbody>[/TABLE]
My entire code for the submission button is following:
Private Sub CommandButton1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("QA Form")
'find
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
'check for a agent name
If Trim(Me.AGT.Value) = "" Then
Me.AGT.SetFocus
MsgBox "Missing Agent name"
Exit Sub
End If
With ws
.Cells(iRow, 1).Value = Me.AGT.Value
.Cells(iRow, 2).Value = Me.SCR.Value
.Cells(iRow, 3).Value = Me.DTE.Value
End With
'clear the data
Me.AGT.Value = ""
Me.SCR.Value = ""
Me.DTE.Value = ""
Me.AGT.SetFocus
End Sub