Hi, I'm completely new to vba. I've tried to work something out but I don't know what I am doing wrong. I would be really grateful if someone could help me out.

Thanks
James

Sub Sensitivity()

Dim a As String
Dim n As Integer
Dim r As Integer
Dim Cell As Range
Dim RNG As Range

'the first row with the volume adjustment factor
r = 80
'Sets the factor to adjust the volume
a = 1 + Sheets("Total").Cells(r, 2).Value

'Applies the factor to the volume table
Do Until r = 86

n = 2
Do Until n = 7
Set RNG = Sheets("Temp").Range(Cells(8, n), Cells(22, n))
For Each Cell In RNG
Cell.Value = Cell.Value * a
Cell.NumberFormat = "0"
Next Cell

n = n + 1
Loop

'Copies and pastes the output of applying volume changes to the model
If r < 85 Then Sheets("Total").Range("C11", "H11").Copy
End If

If r < 85 Then Sheets("Total").Range(Cells(r, 3), Cells(r, 9)).PasteSpecial
End If

r = r + 1

' Changes the factor to apply to the table unless row number is 85, where the factor is set back to put the volume back to the original values
If r = 85 Then a = (1 / a)
Else: a = (1 / a) * (1+ Sheets("Temp").Range(Cells(r, 2)).Value)
End If

Loop

End Sub