# Thread: format number (2000 sr 1)

1. ## format number (2000 sr 1)

I take this value with: var_5_cat = Trim(Mid(riga, 90, 11))
4.900

and my column where i insert this value is in number format

I wolud want to insert this value in the column in this format number 4.900

2. ## Re: format number (2000 sr 1)

1. What is the decimal separator on your system? A point or a comma?
2. What does 4.900 stand for? 4900 or 4 + 9/10?

.. point

4. ## Re: format number (2000 sr 1)

... and what is the answer to the second question?

5. ## Re: format number (2000 sr 1)

peraphs if i post my wbook...
vba psw is: sal21

6. ## Re: format number (2000 sr 1)

So what is the problem? When I run your code, the number is displayed as 4.900. That is what you wanted, isn't it?

7. ## Re: format number (2000 sr 1)

yes, insert this value in the refered column...
But the important is the realated value accept the summ

8. ## Re: format number (2000 sr 1)

Please explain in detail what you mean.

9. ## Re: format number (2000 sr 1)

i am sorry, i have solved...

But is possible to order by date the file in the list box?...
The format is T2253_DATE.TXT
the suffix T2253_ is the same for all file... change only the date, i post many file to make a test.
I dont understand wath criteria VBA use for ordering....

10. ## Re: format number (2000 sr 1)

Add this procedure to a standard module or to the userform module:

Sub SortArrayByDate(arr)
Dim i As Integer, j As Integer
Dim lb As Integer, ub As Integer
Dim d1 As Integer, m1 As Integer, y1 As Integer
Dim d2 As Integer, m2 As Integer, y2 As Integer
Dim strTemp As String
lb = LBound(arr)
ub = UBound(arr)
For i = lb To ub - 1
For j = i + 1 To ub
d1 = Mid(arr(i), 7, 2)
m1 = Mid(arr(i), 9, 2)
y1 = Mid(arr(i), 11, 4)
d2 = Mid(arr(j), 7, 2)
m2 = Mid(arr(j), 9, 2)
y2 = Mid(arr(j), 11, 4)
If DateSerial(y1, m1, d1) > DateSerial(y2, m2, d2) Then
strTemp = arr(i)
arr(i) = arr(j)
arr(j) = strTemp
End If
Next j
Next i
End Sub

And change the UserForm_Initialize procedure as follows:

Private Sub UserForm_Initialize()
Dim arr() As String
Dim i As Integer
Dim strFile As String
' Fill array by looping through the folder
strFile = Dir(strPath & "*.txt")
Do While Not (strFile = "")
ReDim Preserve arr(i)
arr(i) = strFile
i = i + 1
strFile = Dir
Loop
If i = 0 Then Exit Sub
' Sort array
SortArrayByDate arr
' Fill list box
Me.lbxFiles.List = arr
' Select first item in the list
If Me.lbxFiles.ListCount > 0 Then
Me.lbxFiles.Selected(0) = True
End If
End Sub

11. ## Re: format number (2000 sr 1)

Naturally, no WORDS!
Tks

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•