Im doing an assignment for school, it should run but its not running properly, the objective is to calculate final score. It links to an excel file. Please offer any help you can. This is the part im having problems with.
Thanks!
Dim activeSheet
Set activeSheet = xlAppl.Worksheets("Sheet1")
' each excel document can have many work sheets, we will do our work on Sheet1
Dim slope, FinalGrade, rownum, quit
quit = false
rownum = 12
Do
If activeSheet.Cells(rownum, 4).Value = "-1" then
xlAppl.Application.Quit
End If
If activeSheet.Cells(rownum, 5).Value >= "=B1" then
activeSheet.Cells(rownum, 3).Value = "=C1"
else
If activeSheet.Cells(rownum, 5).Value >= "=B2" then
activeSheet.Cells(5, 1).Value = "=(C2-C1)/(B2-B1)" 'a grade
activeSheet.Cells(rownum, 3).Value = "=(((-A5)*(B2-rownum))+C2)"
else
If activeSheet.Cells(rownum, 5).Value >= "=B3" then
activeSheet.Cells(5, 1).Value = "=(C3-C2)/(B3-B2)" 'b grade
activeSheet.Cells(rownum, 3).Value = "=(((-A5)*(B3-rownum))+C3)"
else
If activeSheet.Cells(rownum, 5).Value >= "=B4" then
activeSheet.Cells(5, 1).Value = "=(C4-C3)/(B4-B3)" 'c grade
activeSheet.Cells(rownum, 3).Value = "=(((-A5)*(B4-rownum))+C4)"
else
activeSheet.Cells(5, 1).Value = "=(0-C4)/(0-B4)" 'd grade
activeSheet.Cells(rownum, 3).Value = "=(((-A5)*(0-rownum))+0)"
rownum = rownum + 1
MsgBox "That was fun? No? Thanks for playing"
xlAppl.Application.Quit
End If
End If
End If
End If
Loop Until quit
Thanks!
Dim activeSheet
Set activeSheet = xlAppl.Worksheets("Sheet1")
' each excel document can have many work sheets, we will do our work on Sheet1
Dim slope, FinalGrade, rownum, quit
quit = false
rownum = 12
Do
If activeSheet.Cells(rownum, 4).Value = "-1" then
xlAppl.Application.Quit
End If
If activeSheet.Cells(rownum, 5).Value >= "=B1" then
activeSheet.Cells(rownum, 3).Value = "=C1"
else
If activeSheet.Cells(rownum, 5).Value >= "=B2" then
activeSheet.Cells(5, 1).Value = "=(C2-C1)/(B2-B1)" 'a grade
activeSheet.Cells(rownum, 3).Value = "=(((-A5)*(B2-rownum))+C2)"
else
If activeSheet.Cells(rownum, 5).Value >= "=B3" then
activeSheet.Cells(5, 1).Value = "=(C3-C2)/(B3-B2)" 'b grade
activeSheet.Cells(rownum, 3).Value = "=(((-A5)*(B3-rownum))+C3)"
else
If activeSheet.Cells(rownum, 5).Value >= "=B4" then
activeSheet.Cells(5, 1).Value = "=(C4-C3)/(B4-B3)" 'c grade
activeSheet.Cells(rownum, 3).Value = "=(((-A5)*(B4-rownum))+C4)"
else
activeSheet.Cells(5, 1).Value = "=(0-C4)/(0-B4)" 'd grade
activeSheet.Cells(rownum, 3).Value = "=(((-A5)*(0-rownum))+0)"
rownum = rownum + 1
MsgBox "That was fun? No? Thanks for playing"
xlAppl.Application.Quit
End If
End If
End If
End If
Loop Until quit