dragonfire33
Board Regular
- Joined
- Oct 7, 2021
- Messages
- 90
- Office Version
- 365
- Platform
- Windows
como puedo ejecutar este codigo en la columna "UA" y ordenar de acuerdo a sus dos ultimas cifras dante
VBA Code:
Dim valores As New Collection
Sub Ordenar2UltimasCifras()
'Por Dante Amor
'
Set valores = Nothing
Set r = Range("B1:D9")
cfin = r.Columns.Count + r.Cells(1, 1).Column + 1
Columns(cfin).ClearContents
For Each c In r
Call Agregar(c)
Next
'
For i = valores.Count To 1 Step -1
j = j + 1
Cells(j, cfin) = valores(i)
Next
Set r = Nothing
Set valores = Nothing
End Sub
'
Sub Agregar(valor)
'por.Dante Amor
For i = 1 To valores.Count
If Val(Right(valores(i), 2)) < Val(Right(valor, 2)) Then
valores.Add valor, Before:=i
Exit Sub
End If
Next
valores.Add valor
End Sub