Print 5 columns of 20

Posted on 2000-03-07
Last Modified: 2010-05-02
This project is suppose to print 5 columns of 20 rows.  Could you tell me why it is printing rows of 5?

1.  323 21. 300 41. 275 61. 289 81. 280
20. 297 40. 299 60. 293 80. 300 100. 304
Dim A(30000) As Long
Dim B As Long
Dim C(100) As Long
Private Sub cmdExit_Click()
End Sub

Private Sub Command1_Click()

Print Tab(20); "Name"; Tab; "Project"; vbCrLf
For x = 1 To 30000
    B = A(x)
    C(B) = C(B) + 1
I = 1
For I = 1 To 100
    'print out arrays
    Quiz4.Print Format$(I, "@@@."); C(I); Tab;
    If I Mod 20 = 0 Then Quiz4.Print vbCrLf  'columns

End Sub

Private Sub Form_Load()
Dim I As Integer
'initilizing array
For I = 1 To 3000
    A(I) = Int(Rnd * 101)
End Sub

Private Sub Print_Click()
End Sub
Question by:mad3654
1 Comment
LVL 32

Accepted Solution

bhess1 earned 35 total points
ID: 2593579
vbCrLf is an end of line, not an end of column command.  To get the layout you were trying for (as shown in your example), try this code:

For I = 1 To 20
    'print out arrays
    Quiz4.Print Format$(I, "@@@.");
      C(I); Tab; Format$(I+20, "@@@.");
      C(I+20); Tab; Format$(I+40,
      "@@@."); C(I+40); Tab;
      Format$(I+60, "@@@."); C(I+60);
      Tab; Format$(I+80, "@@@.");

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now