I'm writing a macro and I'm having a hard time understanding excel. The macro check if certain cells are the same, and if the subtraction of cells is less than 103, then it executes code. I'm getting stuck when I try to subtract two cells and assign it to a variable. Any Pointers?
Sub range1()
Dim numResult As Integer
For CHARS = 1 To 20000
If Cells(CHARS, 1) = "" Then CHARS = 20000
For n = 1 To 50
If ([CELLS(CHARS, 1)] = [CELLS(CHARS + 1, 1)]) Then
If ([CELLS(CHARS, 4)] = [CELLS(CHARS + 1, 4)]) Then
numResult = Evaluate([CELLS(CHARS + 1, 2)] & "-" & [CELLS(CHARS, 3)]) '//ERROR
If (numResult < 103) Then
Cells(CHARS + 1, 3).Select
Selection.Cut Destination:=Cells(CHARS, 3)
Rows("(CHARS + 1):(CHARS + 1)").Select
Selection.Delete Shift:=xlUp
End If
End If
Else
Exit For
End If
Next n
Next CHARS
End Sub