Utility – Get Row Range Interval
Calculates the number of rows in a given row range string formatted as “start:end”.
The function splits the input string by the colon character, converts the parts to integers, and computes the inclusive difference between the start and end values.
VB
Public Function xlGetRowRangeInterval(RowRange As String) As Integer
Dim arBound As Integer()
Try
arBound = Split(RowRange, ":").ToList.ConvertAll(Function(str) Int32.Parse(str)).ToArray
Return arBound(UBound(arBound)) - arBound(LBound(arBound)) + 1
Catch ex As Exception
Return 0
End Try
Return 0
End Function