Variables
Dim total As Double declares a variable. Main types: Long (whole numbers), Double (decimals), String (text), Boolean, Range (a range, assigned with Set). Option Explicit at the top of a module forces you to declare every variable — so typos in names show up at once.
Worksheet functions in code
WorksheetFunction.Sum(Range("B2:B8")) — any Excel function: Average, Max, CountIf, VLookup…
Conditions
If score >= 90 Then
grade = "excellent"
ElseIf score >= 60 Then
grade = "pass"
Else
grade = "fail"
End If
With many options Select Case reads better:
Select Case score
Case Is >= 90: grade = "excellent"
Case 75 To 89: grade = "good"
Case Else: grade = "other"
End Select
Messages
MsgBox "Average: " & avg shows a message box (in the trainer — a line in the Output box). The & operator joins text and numbers. Debug.Print writes to the editor's Immediate window — handy for checking values.