I'm wanting to do a subtraction between two numbers, of which they are located in the Columns L and W of the worksheet, I make a for to sweep the rows and make the account about each row, but my result is not coming out correct in val variable, could someone help me? See below my code in vba:
Sub Expense_reports_deadline()
Dim ultimaLinha As Long
Dim val As Long
Dim deadile As String
Dim i As Long
ultimaLinha = Sheet6.Cells(Rows.count, 1).End(xlUp).Row
For i = 6 To ultimaLinha
val = Cells(i, L).Value - Cells(i, W).Value
If val <= 30 Then
MsgBox val
deadline = "on time"
Else
MsgBox val
dedline = "overdue"
End If
Next i
End Sub