Untitled

 avatar
unknown
plain_text
2 years ago
720 B
6
Indexable
Sub Macro1()

'Declare variables
Dim i As Integer
Dim Q1 As String
Dim S1 As String
Dim Q4 As Integer
Dim S4 As Integer

'Start loop at row 4
For i = 4 To 10000
    'Check if Q1 contains "vo"
    Q1 = Cells(i, 17).Value
    If Q1 = "vo" Then
        'If Q1 contains "vo", check if S1 also contains "vo"
        S1 = Cells(i, 19).Value
        If S1 = "vo" Then
            'If S1 contains "vo", calculate the value in Q4 plus S4
            Q4 = Cells(i, 17).Value
            S4 = Cells(i, 19).Value
            Cells(i, 7).Value = Q4 + S4
        Else
            'If S1 does not contain "vo", output data in G4
            Cells(i, 7).Value = Q4
        End If
    End If
Next i

End Sub
Editor is loading...