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 one of the pieces 
of data into a 2nd sheet that has a different layout. It would be something 
like this


*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% 


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.

> 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
>
>






I have also edited the combobox so it populates using the headers in row1 of 
sheet2 (WeightedPage) if that helps at all.

Sub UserForm_Initialize()
> Dim rheadings As Range
> Dim cl As Range
> Set rheadings = Sheets("WeightedPage").Range("A1:I1")
> For Each cl In rheadings
> Me.txtAssignmentType.Value = "Assignment"
> Me.txtAssignmentType.AddItem cl.Value
> Next cl
> End Sub
>

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

Reply via email to