• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

URGENT need help with VB

JimmyLim

Junior Member
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
 
Back
Top