Option Explicit
Sub test()
Dim LNET As String
Dim LPOS As String
Dim LNEG As String
Dim INET As String
Dim IPOS As String
Dim INEG As String
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim l As Integer
Dim m As Integer
LNET = 0
LPOS = 0
LNEG = 0
INET = 0
IPOS = 0
INEG = 0
m = 3
For l = 5 To 49
For i = 3 To 29
j = (2 * i) - 1
k = (2 * i)
If Sheets("Valence").Cells(l, i).Value = "positive" Then
LPOS = LPOS + Sheets("RED").Cells(m, j).Value
IPOS = IPOS + Sheets("RED").Cells(m, k).Value
Else
If Sheets("Valence").Cells(l, i).Value = "neutre" Then
LNET = LNET + Sheets("RED").Cells(m, j).Value
INET = INET + Sheets("RED").Cells(m, k).Value
Else
If Sheets("Valence").Cells(l, i).Value = "négative" Then
LNEG = LNEG + Sheets("RED").Cells(m, j).Value
INEG = INEG + Sheets("RED").Cells(m, k).Value
Else
If Sheets("Valence").Cells(l, i).Value = "" Then
LNEG = LNEG
INEG = INEG
LPOS = LPOS
IPOS = IPOS
LNET = LNET
INET = INET
End If
End If
End If
End If
Next i
Sheets("RED").Cells(m, 72).Value = LNEG
Sheets("RED").Cells(m, 73).Value = LNET
Sheets("RED").Cells(m, 74).Value = LPOS
Sheets("RED").Cells(m, 76).Value = INEG
Sheets("RED").Cells(m, 77).Value = INET
Sheets("RED").Cells(m, 78).Value = IPOS
m = m + 2
Next l
End Sub