Dears,
I have a macro that is writing to the first columns all the values selected from a List Box.
The problem is that values are represented by numbers with leading zeros (to reach 5 digits, eg. 00010, 01245).
However, when values are written in the column A, they are converted to number (10, 1245).
Is there anyway to prevent this?
As a workaround, I'm using a formula to add again leading zeros, but I'm sure there's a quicker way.
Thanks a lot,
D
I have a macro that is writing to the first columns all the values selected from a List Box.
VBA Code:
Private Sub GO_Click()
Dim itemsselected As String
Dim x As Long
Columns("A:A").Select
Selection.ClearContents
Range("A1").Select
For x = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(x) = True Then
ActiveCell = ListBox1.List(x)
ActiveCell.Offset(1, 0).Select
ListBox1.Selected(x) = False 'unselect
End If
Next x
End Sub
However, when values are written in the column A, they are converted to number (10, 1245).
Is there anyway to prevent this?
As a workaround, I'm using a formula to add again leading zeros, but I'm sure there's a quicker way.
Thanks a lot,
D