Grade Help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Thanks Gord for the code below, Every time I create a new excel spreadsheet and paste the code it works. But when I close the sheet and open again it does not work. Only works in a new excel workbook but not once you save. Any ide

Thanks
 
sorry fogot the cod

Private Sub Worksheet_Change(ByVal Target As Range
Dim rng As Rang
Dim vRngInput As Varian
Set vRngInput = Intersect(Target, Range("A:A")
n = Target.Ro
If vRngInput Is Nothing Then Exit Su
For Each rng In vRngInpu
'Determine the rang
Select Case rng.Valu
Case Is < 60: Text = "F
Case 60 To 62: Text = "D-
Case 63 To 66: Text = "D
Case 67 To 69: Text = "D+
Case 70 To 72: Text = "C-
Case 73 To 76: Text = "C
Case 77 To 79: Text = "C+
Case 80 To 82: Text = "B-
Case 83 To 86: Text = "B
Case 87 To 89: Text = "B+
Case 90 To 92: Text = "A-
Case 93 To 99: Text = "A
Case Is > 99: Text = "A+
End Selec
'Apply the Letter Grad
Excel.Range("B" & n).Value = Tex
Next rn
End Su


----- Teacher wrote: ----

Thanks Gord for the code below, Every time I create a new excel spreadsheet and paste the code it works. But when I close the sheet and open again it does not work. Only works in a new excel workbook but not once you save. Any ide

Thanks
 
Teacher,

Did you put it in the worksheet code module (right-click on the tab name,
select View code, paste the code)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Teacher said:
sorry fogot the code

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Dim vRngInput As Variant
Set vRngInput = Intersect(Target, Range("A:A"))
n = Target.Row
If vRngInput Is Nothing Then Exit Sub
For Each rng In vRngInput
'Determine the range
Select Case rng.Value
Case Is < 60: Text = "F"
Case 60 To 62: Text = "D-"
Case 63 To 66: Text = "D"
Case 67 To 69: Text = "D+"
Case 70 To 72: Text = "C-"
Case 73 To 76: Text = "C"
Case 77 To 79: Text = "C+"
Case 80 To 82: Text = "B-"
Case 83 To 86: Text = "B"
Case 87 To 89: Text = "B+"
Case 90 To 92: Text = "A-"
Case 93 To 99: Text = "A"
Case Is > 99: Text = "A+"
End Select
'Apply the Letter Grade
Excel.Range("B" & n).Value = Text
Next rng
End Sub



----- Teacher wrote: -----

Thanks Gord for the code below, Every time I create a new excel
spreadsheet and paste the code it works. But when I close the sheet and open
again it does not work. Only works in a new excel workbook but not once you
save. Any idea
 
Teacher

Teacher

From my original post I quote below.......

Some VBA event code for your perusal.

Right-click on the sheet tab and "View Code"

Copy/paste this code into that blank module. Adjust numbers and grades to
suit.

End quote..............

The code is Worksheet Event code and must be in the Worksheet module.

When you save, it will be saved with the workbook.

It won't be in a New Workbook or New Worksheet unless you make a Template of
the Book and/or Sheet with the code entered.

Gord
 
The code is still there but it does not work. If I paste the same code in new workbook it works but when I save and close it and reopens again it does not wor

----- Bob Phillips wrote: ----

Teacher

Did you put it in the worksheet code module (right-click on the tab name
select View code, paste the code

--

HT

Bob Phillip
... looking out across Poole Harbour to the Purbeck
(remove nothere from the email address if mailing direct

Teacher said:
sorry fogot the cod
Dim rng As Rang
Dim vRngInput As Varian
Set vRngInput = Intersect(Target, Range("A:A")
n = Target.Ro
If vRngInput Is Nothing Then Exit Su
For Each rng In vRngInpu
'Determine the rang
Select Case rng.Valu
Case Is < 60: Text = "F
Case 60 To 62: Text = "D-
Case 63 To 66: Text = "D
Case 67 To 69: Text = "D+
Case 70 To 72: Text = "C-
Case 73 To 76: Text = "C
Case 77 To 79: Text = "C+
Case 80 To 82: Text = "B-
Case 83 To 86: Text = "B
Case 87 To 89: Text = "B+
Case 90 To 92: Text = "A-
Case 93 To 99: Text = "A
Case Is > 99: Text = "A+
End Selec
'Apply the Letter Grad
Excel.Range("B" & n).Value = Tex
Next rn
End Su
spreadsheet and paste the code it works. But when I close the sheet and ope
again it does not work. Only works in a new excel workbook but not once yo
save. Any ide
 
Teacher

What is "doesn't work"? If you enter new grade numbers, the letter grades
don't change?

This is Event code so something has to change to create an "Event".

Send me the workbook if you want. I'll take a look at it.

Change the AT and DOT to the appropriate characters to get my email address.

Gord
 
Back
Top