Lberteh
08-19-2013, 09:04 AM
Hi all,
I have a userform named Telas which contains a combobox getting its items from a range of cells in my worksheet.
Here is the code:
Private Sub UserForm_activate()
Dim WS As Worksheet
Dim LastRow As Long
Dim aCell As Range
Set WS = Worksheets("Listas")
With WS
LastRow = .Cells(.Rows.Count, "K").End(xlUp).Row
For Each aCell In .Range("K2:K" & LastRow)
If aCell.Value <> "" Then
Me.ComboBox1.AddItem aCell.Value
End If
Next
End With
With WS
LastRow = .Cells(.Rows.Count, "L").End(xlUp).Row
For Each aCell In .Range("L2:L" & LastRow)
If aCell.Value <> "" Then
Me.ComboBox2.AddItem aCell.Value
End If
Next
End With
End Sub
The problem is: In my cell it is a number: 14.7
When click the combobox, the number in the list is 14,7 and because of this "," I can't multiply this number cause it only identifies as 14.
How can I make it get the correct value without substituting "," for "." with code?
Thank you
I have a userform named Telas which contains a combobox getting its items from a range of cells in my worksheet.
Here is the code:
Private Sub UserForm_activate()
Dim WS As Worksheet
Dim LastRow As Long
Dim aCell As Range
Set WS = Worksheets("Listas")
With WS
LastRow = .Cells(.Rows.Count, "K").End(xlUp).Row
For Each aCell In .Range("K2:K" & LastRow)
If aCell.Value <> "" Then
Me.ComboBox1.AddItem aCell.Value
End If
Next
End With
With WS
LastRow = .Cells(.Rows.Count, "L").End(xlUp).Row
For Each aCell In .Range("L2:L" & LastRow)
If aCell.Value <> "" Then
Me.ComboBox2.AddItem aCell.Value
End If
Next
End With
End Sub
The problem is: In my cell it is a number: 14.7
When click the combobox, the number in the list is 14,7 and because of this "," I can't multiply this number cause it only identifies as 14.
How can I make it get the correct value without substituting "," for "." with code?
Thank you