Hello,
I have this simple code that I planned to use for formatting output of array to msgbox or userform.
I want to have output formatted in rows and columns.
This is a code:
Array type is variant, I have name, numbers and dates.
I can't figure out why the output is not working properly. It is not completely messed up but it is not lined up correctly.
This part of code should have variable spaces between words and word + spaces should always have same number of characters - 25
I also tried with vbtab, but it doesn't give me good results as well, because if some strings are much shorter tab does not work properly.
What am I doing wrong? How can I format output in columns?
I have this simple code that I planned to use for formatting output of array to msgbox or userform.
I want to have output formatted in rows and columns.
This is a code:
VBA Code:
For i = 1 To nr
For j = 1 To nc
k = Len(arrUpdateResult(i, j))
strResult = strResult & arrUpdateResult(i, j) & Space(25-k)
Next j
strResult = strResult & vbCrLf
Next i
msgbox strResult
ufUserForm.lblLabel1.Caption = strResult
Array type is variant, I have name, numbers and dates.
I can't figure out why the output is not working properly. It is not completely messed up but it is not lined up correctly.
This part of code should have variable spaces between words and word + spaces should always have same number of characters - 25
VBA Code:
k = Len(arrUpdateResult(i, j))
strResult = strResult & arrUpdateResult(i, j) & Space(25-k)
I also tried with vbtab, but it doesn't give me good results as well, because if some strings are much shorter tab does not work properly.
What am I doing wrong? How can I format output in columns?