V
vsoler
I'm working with an array (copied from a range) that contains some
null, empty or "" values (I do not know how to call them). When I copy
the array back to the range these empty values are converted into
zeroes, which is an undesired result for me. I would like them to stay
as empty.
How can I do it? (I think reading the code through is not necessary)
Any help is appreciated
********************************************************************************
Function Igual2(Rng As Range) As Variant
Dim Vector() As Variant
Dim i As Integer, j As Integer
Vector = Rng.Value
i = UBound(Vector, 1)
ReDim Preserve Vector(1 To i, 1 To 2)
For j = 1 To i
Vector(j, 2) = j
Next j
Vector = BubbleSort(Vector)
Igual2 = Vector
End Function
Function BubbleSort(List())
Dim First As Integer, Last As Integer
Dim i As Integer, j As Integer
Dim Temp
First = LBound(List)
Last = UBound(List)
For i = 1 To Last - 1
For j = i + 1 To Last
If List(i, 1) > List(j, 1) Then
Temp = List(j, 1)
List(j, 1) = List(i, 1)
List(i, 1) = Temp
End If
Next j
Next i
BubbleSort = List
End Function
null, empty or "" values (I do not know how to call them). When I copy
the array back to the range these empty values are converted into
zeroes, which is an undesired result for me. I would like them to stay
as empty.
How can I do it? (I think reading the code through is not necessary)
Any help is appreciated
********************************************************************************
Function Igual2(Rng As Range) As Variant
Dim Vector() As Variant
Dim i As Integer, j As Integer
Vector = Rng.Value
i = UBound(Vector, 1)
ReDim Preserve Vector(1 To i, 1 To 2)
For j = 1 To i
Vector(j, 2) = j
Next j
Vector = BubbleSort(Vector)
Igual2 = Vector
End Function
Function BubbleSort(List())
Dim First As Integer, Last As Integer
Dim i As Integer, j As Integer
Dim Temp
First = LBound(List)
Last = UBound(List)
For i = 1 To Last - 1
For j = i + 1 To Last
If List(i, 1) > List(j, 1) Then
Temp = List(j, 1)
List(j, 1) = List(i, 1)
List(i, 1) = Temp
End If
Next j
Next i
BubbleSort = List
End Function