Hi everybody,
I have this VBA code which works on the data starting from Row2 of worksheet. Instead of Row2, I want it to start from row5. I tried to change it a little but I was not successful. How can i do this? please. thanks.
I have this VBA code which works on the data starting from Row2 of worksheet. Instead of Row2, I want it to start from row5. I tried to change it a little but I was not successful. How can i do this? please. thanks.
Code:
Sub Intervals() Dim R As Range, C As Range
With Cells(1).CurrentRegion
With .Offset(1).Resize(.Rows.Count - 1)
For Each R In .Cells
Set C = .Find(R.Value, R, , 1, , , 2)
If (C.Address <> R.Address) * (C.Row > R.Row) Then
R.Offset(, 7) = C.Row - R.Row - 1
Else
R.Offset(, 7) = "na"
End If
Next
End With
End With
End Sub