I would like to find a given value in a range, and if I find the value I would like to put it in an array. After the loop I would like to give the smallest value in the array to a variable.
How is is possible?
For k = 2 To LastRow_Roles
If roles_sheet.Cells(k, 2).Value = "Admin" Then
selected_number = roles_sheet.Cells(k, 1).Value
ReDim aArray(0 To UBound(aArray) + 1) As Variant
aArray(UBound(aArray)) = selected_number
end if
next k
minimum_value = Application.min(aArray)
low_sheet.Cells(1, 1) = minimum_value
Erase aArray
ReDim aArray(0 To 1) As Variant