I currently have a userform that works perfectly with the first sheet and dont want to change that. What I would like to do is add this information into a 2nd sheet that has a different layout. It would be something like this
<tbody>
</tbody>
Each of these columns is named the same as the headers. In my form I would like for it to input as it is now in sheet1 (GradeBook) and for Sheet2 I would like for the grade only to be input into sheet2. Somehow it would need to match the correct column using the assignment name given using a combobox in the form. Here is the main part of the script for the info input.
Hopefully this isnt hard to do and I explained it without sounding like a babbling baboon
Classwork | Drafts | Records | Portfolio | Final |
98% | 78% | 23% | 98% | 0% |
78% | 23% | 78% | 78% | |
78% | 89% | 0% | 78% | |
23% | 23% | 78% | 23% | |
23% | 98% | 98% |
<tbody>
</tbody>
Each of these columns is named the same as the headers. In my form I would like for it to input as it is now in sheet1 (GradeBook) and for Sheet2 I would like for the grade only to be input into sheet2. Somehow it would need to match the correct column using the assignment name given using a combobox in the form. Here is the main part of the script for the info input.
Code:
Private Sub cmdSubmit_Click()
Application.ScreenUpdating = False
Dim NextRw As Long
Dim ws As Worksheet
Dim startRow As Long
Dim CelFormat As String
Set ws = Courses
NextRw = ws.Cells(Rows.Count, 1).End(xlUp).Offset(2, 0).Row
If NextRw < 6 Then NextRw = 6
'<< Add data to worksheet >>
ws.Cells(NextRw + 0, "A") = Me.txtAssignmentName.Value
ws.Cells(NextRw + 1, "A") = Me.txtDate.Value
ws.Cells(NextRw + 1, "A") = "Due: " & Me.txtDate.Value
ws.Cells(NextRw + 2, "A") = Me.txtAssignmentType.Value
If (Me.txtPointsReceived.Value & "X" = "X") Then
ws.Cells(NextRw + 0, "D").Value = "-"
Else
If InStr(1, txtPointsReceived, "%") = 0 Then 'and if txtAssignmentName.value matches sheets2 column name insert grade in next open cell that column starting at @ row3
CelFormat = "0.00"
Else
CelFormat = "0.00%"
End If
With ws.Cells(NextRw + 0, "D")
.NumberFormat = CelFormat
.Value = Me.txtPointsReceived.Value
End With
End If
If InStr(1, txtPointsPossible, "%") = 0 Then
CelFormat = """/"" 0.00"
Else
CelFormat = """/"" 0.00%"
End If
With ws.Cells(NextRw + 0, "E")
.NumberFormat = CelFormat
.Value = Me.txtPointsPossible.Value
End With
Unload Me
End Sub
Hopefully this isnt hard to do and I explained it without sounding like a babbling baboon
Last edited: