I have been getting a type mismatch error with the following code. I believe it is happening within the 'if' statement.
Sub Hold()
Dim c As Range
Set c = Range("C2000:C2050")
Dim r1 As Long
Dim r2 As Long
Dim x As Long
Dim i As Long
For x = 2 To c.Cells.Count
r1 = c.Cells(x, 1).Value
r2 = c.Cells(x - 1, 1).Value
If r1 - r2 = 1 Then
Range("K5:K303").Value = Range("K5:K303").Value - Range("K5").Value
Range("G" & x - 1 & ":G" & x + 297).Copy Destination:=Range("K5")
Exit For
End If
Next x
End Sub
Sub Hold()
Dim c As Range
Set c = Range("C2000:C2050")
Dim r1 As Long
Dim r2 As Long
Dim x As Long
Dim i As Long
For x = 2 To c.Cells.Count
r1 = c.Cells(x, 1).Value
r2 = c.Cells(x - 1, 1).Value
If r1 - r2 = 1 Then
Range("K5:K303").Value = Range("K5:K303").Value - Range("K5").Value
Range("G" & x - 1 & ":G" & x + 297).Copy Destination:=Range("K5")
Exit For
End If
Next x
End Sub