Posts by dingsdaffy
-
-
Hello, so I want the program to read the number from the score tab (txtScore) and change it to an alphabet grade, and put it in the alphabet score tab (txtAlphabetS) in my userform, but I don't know how to make the subroutine to read the input in score tab and then insert it to alphabet score tab. Here's the userform design and the code
Code
Display MorePrivate Sub cmdInput_Click() Name = txtName.Text ID = txtID.Text Score = txtScore.Text AlphabetScore = txtAlphabetS.Text Dim wsh As Worksheet Set wsh = ThisWorkbook.Worksheets("sheet2") Set tb1 = wsh.ListObjects("Table4") Dim aRow As ListRow Set aRow = tb1.ListRows.Add With aRow .Range(1) = Name .Range(2) = ID .Range(3) = Score .Range(4) = AlphabetScore End With End Sub Sub aScore() Dim aScore As Integer aScore = txtScore.Text Select Case (aScore) Case Is < 41 txtAlphabetS.Text = ("E") Case 41 To 50 txtAlphabetS.Text = ("D") Case 51 To 60 txtAlphabetS.Text = ("C") Case 61 To 80 txtAlphabetS.Text = ("B") Case 81 To 100 txtAlphabetS.Text = ("A") End Select End Sub Private Sub cmdReset_Click() Unload Me UserForm2.Show End Sub
Actually this is from the test that was held this morning, but I just want to know how to solve this problem because as you can see, I'm terrible at programming and I don't see any bright future in this subject alone. Thankfully I will not face any programming subject in my next semester (If I don't fail this class). Any help would be appreciated, thank you.
-
Thank you very much for your help! I really appreciate it
-
So I have this assignment where I must sort numbers in order. I already made the code and it works, but it doesn't loop at all so I have to manually rerun the program. Here's what I have
Code
Display MoreSub SortingNumber() For i = 1 To 16 For j = 1 To 16 If Cells(j, i) > Cells(j + 1, 2) Then 'swap the two values Temp = Cells(j, 2) Cells(j, 2) = Cells(j + 1, 2) Cells(j + 1, 2) = Temp Application.Wait (Now + TimeValue("0:00:01")) End If Next j Next i End Sub
And the data is in the attachment below.
My question is, how do I make the program loop by itself? I really appreciate any help! Thanks in advance.