I have a macro that exports cell data to a text file. I need the cell contents to be right justified. Here is the code as it stands now:
intFH = FreeFile()
Open "Node.txt" For Output As intFH
Dim DNX As Single
Dim DNY As Single
Dim k As Integer
' Loop to print out node data - Note that Z dimesion is always zero for 2D Axisymmetric Models
For i = 1 To 9
DNX = Cells(i + 4, 10).Value
DNY = Cells(i + 4, 11).Value
Print #intFH, vbTab & i & vbTab & DNX & vbTab & DNY
Next i
For i = 1 To 43
DNX = Cells(i + 13, 10).Value
DNY = Cells(i + 13, 11).Value
k = i + 9
Print #intFH, vbTab & k & vbTab & DNX & vbTab & DNY
Next i
I need to have the counter i right justified in column 8 so that the numbers all line up with the ones digit in column 8 and the tens digit in column 7. The next number on the line is a real number in the format x.yyyyyyyyyyy up to 11 decimal places. The third number of the line will be the same way.
Typical lines need to look like this
bbbbbbb1bb8.610000000000bbbbb3.000000000000
bbbbbb10bb77.480000000000000096.00000000000
Is there a way to do this will commands that will handle the proper justifications and trailing decimal points properly?
Any help is greatly appreciated. Thank you.
intFH = FreeFile()
Open "Node.txt" For Output As intFH
Dim DNX As Single
Dim DNY As Single
Dim k As Integer
' Loop to print out node data - Note that Z dimesion is always zero for 2D Axisymmetric Models
For i = 1 To 9
DNX = Cells(i + 4, 10).Value
DNY = Cells(i + 4, 11).Value
Print #intFH, vbTab & i & vbTab & DNX & vbTab & DNY
Next i
For i = 1 To 43
DNX = Cells(i + 13, 10).Value
DNY = Cells(i + 13, 11).Value
k = i + 9
Print #intFH, vbTab & k & vbTab & DNX & vbTab & DNY
Next i
I need to have the counter i right justified in column 8 so that the numbers all line up with the ones digit in column 8 and the tens digit in column 7. The next number on the line is a real number in the format x.yyyyyyyyyyy up to 11 decimal places. The third number of the line will be the same way.
Typical lines need to look like this
bbbbbbb1bb8.610000000000bbbbb3.000000000000
bbbbbb10bb77.480000000000000096.00000000000
Is there a way to do this will commands that will handle the proper justifications and trailing decimal points properly?
Any help is greatly appreciated. Thank you.