[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Print 5 columns of 20

Posted on 2000-03-07
1
Medium Priority
?
130 Views
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?

sample:
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
End Sub

Private Sub Command1_Click()

Cls
Print Tab(20); "Name"; Tab; "Project"; vbCrLf
For x = 1 To 30000
    B = A(x)
    C(B) = C(B) + 1
Next
   
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
Next

End Sub

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



Private Sub Print_Click()
Quiz4.PrintForm
End Sub
0
Comment
Question by:mad3654
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 32

Accepted Solution

by:
Brendt Hess earned 140 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, "@@@.");
      C(I+80)
Next
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

650 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