saikrishna
11-23-2016, 11:03 PM
Hi All,
I'm trying a function to get sequence between 2 values. Below given example for better understand.
1st Value = A1245
2nd Value = A1257
When I give above values in 'AddNum' function. It should give 'A1245,A1246,A1247' as result.
Below given vba code wrote by myself and i requesting you, please help on this.
Public x As Double
Function AddNum(Val1 As Variant, Val2 As Variant)
If Val1 = "" Or Val2 = "" Then
Exit Function
Else
x = -(Right(Val1, 4) - Right(Val2, 4))
End If
Dim myary As Variant
ReDim myary(x) As Variant
For y = LBound(myary) To UBound(myary)
Z = Right(Val1, 4) + y
myary(y) = Left(Val1, 2) & Z
ActiveCell.Offset(0, y + 1).Value = myary(y)
Next y
End Function
I'm trying a function to get sequence between 2 values. Below given example for better understand.
1st Value = A1245
2nd Value = A1257
When I give above values in 'AddNum' function. It should give 'A1245,A1246,A1247' as result.
Below given vba code wrote by myself and i requesting you, please help on this.
Public x As Double
Function AddNum(Val1 As Variant, Val2 As Variant)
If Val1 = "" Or Val2 = "" Then
Exit Function
Else
x = -(Right(Val1, 4) - Right(Val2, 4))
End If
Dim myary As Variant
ReDim myary(x) As Variant
For y = LBound(myary) To UBound(myary)
Z = Right(Val1, 4) + y
myary(y) = Left(Val1, 2) & Z
ActiveCell.Offset(0, y + 1).Value = myary(y)
Next y
End Function