Stephen_IV
Well-known Member
- Joined
- Mar 17, 2003
- Messages
- 1,180
- Office Version
- 365
- 2019
- Platform
- Windows
I am trying to get the highest grade per row with VBA.
<style type="text/css">
table.tableizer-table {
font-size: 12px;
border: 1px solid #CCC ;
font-family: Arial, Helvetica, sans-serif;
}
.tableizer-table td {
padding: 4px;
margin: 3px;
border: 1px solid #CCC ;
}
.tableizer-table th {
background-color: #104E8B ;
color: #FFF ;
font-weight: bold;
}
</style>
<table class="tableizer-table">
<thead><tr class="tableizer-firstrow"><th>English</th><th>A</th><th>B</th><th>C</th><th>A</th><th>F</th><th>A</th><th>B</th></tr></thead><tbody>
<tr><td>Math</td><td>A+</td><td>B</td><td>A</td><td>C</td><td>C+</td><td> </td><td> </td></tr>
<tr><td>Science</td><td>F</td><td>C</td><td>C</td><td>F</td><td>F</td><td> </td><td> </td></tr>
<tr><td>SS</td><td>B+</td><td>B</td><td>C</td><td>D+</td><td>B+</td><td>C</td><td></td></tr>
</tbody></table>
this is the output that I desire,
<style type="text/css">
table.tableizer-table {
font-size: 12px;
border: 1px solid #CCC ;
font-family: Arial, Helvetica, sans-serif;
}
.tableizer-table td {
padding: 4px;
margin: 3px;
border: 1px solid #CCC ;
}
.tableizer-table th {
background-color: #104E8B ;
color: #FFF ;
font-weight: bold;
}
</style>
<table class="tableizer-table">
<thead><tr class="tableizer-firstrow"><th>A</th></tr></thead><tbody>
<tr><td>A+</td></tr>
<tr><td>C</td></tr>
<tr><td>B+</td></tr>
</tbody></table>
this is the code that I have so far but need help! Thanks in advance.
<style type="text/css">
table.tableizer-table {
font-size: 12px;
border: 1px solid #CCC ;
font-family: Arial, Helvetica, sans-serif;
}
.tableizer-table td {
padding: 4px;
margin: 3px;
border: 1px solid #CCC ;
}
.tableizer-table th {
background-color: #104E8B ;
color: #FFF ;
font-weight: bold;
}
</style>
<table class="tableizer-table">
<thead><tr class="tableizer-firstrow"><th>English</th><th>A</th><th>B</th><th>C</th><th>A</th><th>F</th><th>A</th><th>B</th></tr></thead><tbody>
<tr><td>Math</td><td>A+</td><td>B</td><td>A</td><td>C</td><td>C+</td><td> </td><td> </td></tr>
<tr><td>Science</td><td>F</td><td>C</td><td>C</td><td>F</td><td>F</td><td> </td><td> </td></tr>
<tr><td>SS</td><td>B+</td><td>B</td><td>C</td><td>D+</td><td>B+</td><td>C</td><td></td></tr>
</tbody></table>
this is the output that I desire,
<style type="text/css">
table.tableizer-table {
font-size: 12px;
border: 1px solid #CCC ;
font-family: Arial, Helvetica, sans-serif;
}
.tableizer-table td {
padding: 4px;
margin: 3px;
border: 1px solid #CCC ;
}
.tableizer-table th {
background-color: #104E8B ;
color: #FFF ;
font-weight: bold;
}
</style>
<table class="tableizer-table">
<thead><tr class="tableizer-firstrow"><th>A</th></tr></thead><tbody>
<tr><td>A+</td></tr>
<tr><td>C</td></tr>
<tr><td>B+</td></tr>
</tbody></table>
this is the code that I have so far but need help! Thanks in advance.
Code:
Function xscore(r As Range) As String
Dim d As Double
For Each c In r
Select Case UCase(Trim(c))
Case "A+": xscore = 0
Case "A": xscore = 1
Case "A-": xscore = 2
Case "B+": xscore = 3
Case "B": xscore = 4
Case "B-": xscore = 5
Case "C+": xscore = 6
Case "C": xscore = 7
Case "C-": xscore = 8
Case "D+": xscore = 9
Case "D": xscore = 10
Case "D-": xscore = 11
Case "F": xscore = 12
End Select
d = d + xscore
Next
End Function