View Single Post
 
Old 04-13-2023, 01:55 PM
p45cal's Avatar
p45cal p45cal is offline Windows 10 Office 2019
Expert
 
Join Date: Apr 2014
Posts: 956
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

Quite surpries you want this in one cell.
In the attached formula in cell D2:
=InCellSeq(A1,B1)
supported by UDF:
Code:
Function InCellSeq(Start, Finish)
For I = Start To Finish
  myStr = Join(Array(myStr, I))
Next I
InCellSeq = Application.Trim(myStr)
End Function
There's also another UDF used in cell(s) K2:R2 which uses this UDF, stolen from : UDF for sequence function | MrExcel Message Board ):
Code:
Function ArrSeq(lRows As Long, Optional lCols As Long = 1, Optional lStart As Long = 1, Optional lStep As Long = 1) As Variant
Dim R As Long, C As Long, Nums As Long
Nums = lStart
For R = 1 To lRows
  For C = 1 To lCols
    ArrSeq = ArrSeq & "," & Nums
    Nums = Nums + lStep
  Next
  ArrSeq = ArrSeq & ";"
Next
ArrSeq = Evaluate("{" & Replace(Mid(Left(ArrSeq, Len(ArrSeq) - 1), 2), ";,", ";") & "}")
End Function
Attached Files
File Type: xlsm msofficeforums50737.xlsm (18.2 KB, 4 views)
Reply With Quote