-
I want to display data before printing or saving. I need to put it from a loop to columns. In testing all I can do is print the whole list either all the way down the left side, or with an If Then statement with different Tab() half goes down the left, and half is Tabbed to where I want it, but it starts at the bottom og the first list, not next to it like I want.
1 xxx 6 xxx
2 xxx 7 xxx
3 xxx 8 xxx
4 xxx 9 xxx
5 xxx 10 xxx
This is how I want it if this worked right, but I keep getting it like this
1 xxx
2 xxx
3 xxx
4 xxx
5 xxx
6 xxx
7 xxx
8 xxx
9 xxx
10 xxx
Can anyone help. I don't even know where to look for help. What would you call this. Here is a sample from my code. I am trying to display h and v
For h = 1 To r * 2 - 1
v = (r # 2 # (####((r - h) / r))) _
- (r - h) # (###(2 # (r # h) - h ^ #))
'If statement here like
If h < r Then
x = 10
Else
x = 50
v = l * v / 231
v = Format(v, "######.##")
Print Tab(x)h, v
Next h
-
Is this the sort of thing you want?
I've used a textbox here. If you do, make sure multiline is "true"
Code:
Option Explicit
Dim arrayOfData(10) As String
Private Sub Command1_Click()
Dim halfway As Integer
Dim i As Integer
Dim j As Integer
halfway = UBound(arrayOfData()) \ 2
For i = 0 To halfway - 1
j = i + halfway
Text1.Text = Text1.Text & i & " " & arrayOfData(i) & vbTab & j & " " & arrayOfData(j) & vbCrLf
Next i
End Sub
Private Sub Form_Load()
Dim i As Integer
For i = 0 To 9
arrayOfData(i) = "xxx"
Next i
End Sub
-
this is what i have
here is the code.
Option Explicit
Private Sub Command1_Click()
Dim r
Dim l
Dim h
Dim v
r = 22.75
l = 48
For h = 1 To r * 2 - 1
v = (r ^ 2 * (ArcCos((r - h) / r))) _
- (r - h) * (Sqr(2 * (r * h) - h ^ 2))
v = l * v / 231
v = Format(v, "######.##")
If h < r Then
Print h, v
Else
Print h, v; Tab(40);
End If
Next h
End Sub
h = inches and v is volume. I need h & v on the left side of the page from 1 to the halfway point, then halfway to end h&v in the center. Do I need to put it in an array, and if so, how do I load it in. I think the help I got would work if I could load the array with my variables. Is this possible?
1 2.86 24 286.87
2 4.65 25 301.34
Like this.
'Inverse Cosine
Function ArcCos(x As Double) As Double
ArcCos = Atn(-x / Sqr(-x * x + 1)) + 2 * Atn(1)
End Function