Dear all expert programmers,
Please see my code below and suggest me, is this the best way for display split array?
Thank you for all posts.Code:Option Explicit Private strTestarray(19) As String '<-- ubound of array can be 32767 Private Sub Command1_Click() Dim i As Integer Dim iPart As Integer Const intMaxpart = 2 '<-- this value can change to other For i = 0 To 19 strTestarray(i) = Right("0000" & i, 5) Next iPart = (UBound(strTestarray) + 1) \ intMaxpart For i = 1 To iPart Call DisplaySplitarray(i, intMaxpart) Next End Sub Private Sub DisplaySplitarray(ByVal lngPart As Long, ByVal imax As Integer) Dim iLoop As Integer Dim strNewdata() As String Dim jindex As Long ReDim strNewdata(imax - 1) For iLoop = (lngPart - 1) * imax To (lngPart * imax) - 1 strNewdata(jindex) = strTestarray(iLoop) jindex = jindex + 1 Next MsgBox lngPart & vbCrLf & Join(strNewdata, vbCrLf) & vbCrLf & "==================" & vbCrLf End Sub




Reply With Quote